Added feature to render Collectible and trinket icons
This commit is contained in:
1 parent
9c56240e64
commit
f562d6cd7d
5 files changed
+58
-10
No files matched your search
+24
-9
@@ -303,21 +303,36 @@ function EID:getIcon(str)
|
||||
if str == nil then
|
||||
return EID.InlineIcons["ERROR"]
|
||||
end
|
||||
local strTrimmed =
|
||||
string.gsub(
|
||||
str,
|
||||
"{{(.-)}}",
|
||||
function(a)
|
||||
return a
|
||||
end
|
||||
)
|
||||
local strTrimmed = string.gsub(str,"{{(.-)}}",function(a) return a end )
|
||||
if #strTrimmed <= #str then
|
||||
return EID.InlineIcons[strTrimmed] or EID.InlineIcons["ERROR"]
|
||||
return EID:createItemIconObject(strTrimmed) or EID.InlineIcons[strTrimmed] or EID.InlineIcons["ERROR"]
|
||||
else
|
||||
return EID.InlineIcons["ERROR"]
|
||||
end
|
||||
end
|
||||
|
||||
-- Tries to read special markup used to generate icons for all Collectibles/Trinkets
|
||||
-- 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 then
|
||||
item = EID.itemConfig:GetCollectible(tonumber(collID))
|
||||
end
|
||||
local trinketID,numReplace2 = string.gsub(str, "Trinket", "")
|
||||
if numReplace2>0 then
|
||||
item = EID.itemConfig:GetTrinket(tonumber(trinketID))
|
||||
end
|
||||
if item == nil then
|
||||
return nil
|
||||
end
|
||||
local spriteDummy = Sprite()
|
||||
spriteDummy:Load("gfx/eid_inline_icons.anm2", true)
|
||||
spriteDummy:ReplaceSpritesheet(1, item.GfxFileName)
|
||||
spriteDummy:LoadGraphics()
|
||||
return {"ItemIcon",0,7,7,-4,-2,spriteDummy}
|
||||
end
|
||||
|
||||
-- Returns the icon for a given transformation name or ID
|
||||
function EID:getTransformationIcon(str)
|
||||
if str == nil then
|
||||
|
||||
@@ -63,7 +63,9 @@ EID.InlineIcons = {
|
||||
["Pill"] = {"pickups", 8, 9, 9},
|
||||
["Battery"] = {"pickups", 9, 8, 9},
|
||||
["Collectible"] = {"Collectible", 0, 7, 7},
|
||||
----- Use Markup "Collectible"+ ITEMID to render collectible sprites (example: {{Collectible1}} = Sad Onion)
|
||||
["Trinket"] = {"Trinket", 0, 7, 7},
|
||||
----- Use Markup "Trinket"+ ITEMID to render trinket sprites (example: {{Trinket1}} = Swallowed Penny)
|
||||
["Slotmachine"] = {"Slotmachine", 0, 7, 7},
|
||||
-- Room Icons
|
||||
["Shop"] = {"roomicons", 0, 7, 9},
|
||||
|
||||
@@ -67,6 +67,7 @@ dummySprite2:Load("gfx/eid_inline_icons.anm2", true)
|
||||
EID.InlineIcons["Test"] = {"pickups", -1, 9, 9, -1, 0, dummySprite2}
|
||||
|
||||
__eidItemDescriptions[2] = "{{Bomb}} Emote {{Key}} Test {{Test}}{{TestIcon}} {{ColorBlackBlink}}description {{SomeInvalidInnerStuff}} cool" -- 5.100.2 = Inner Eye
|
||||
__eidItemDescriptions[6] = "This item as Inline Icon {{Collectible6}}#And here are others {{Collectible69}} {{Collectible16}} {{Collectible323}} {{Collectible345}} {{Collectible223}}#And some trinket sprites {{Trinket12}} {{Trinket22}} {{Trinket1}} {{Trinket55}} {{Trinket100}} {{Trinket123}}" -- 5.100.2 = Inner Eye
|
||||
|
||||
------ Test: adding custom transformation icon ------
|
||||
EID.InlineIcons["SomeTestTransformation"] = {"hearts", 2, 9, 9, -1, 0, dummySprite}
|
||||
|
||||
@@ -14,6 +14,9 @@ EID.IconSprite:Load("gfx/icons.anm2", true)
|
||||
EID.InlineIconSprite = Sprite()
|
||||
EID.InlineIconSprite:Load("gfx/eid_inline_icons.anm2", true)
|
||||
|
||||
EID.ItemSprite = Sprite()
|
||||
EID.ItemSprite:Load("gfx/005.100_collectible.anm2", true)
|
||||
|
||||
local ArrowSprite = Sprite()
|
||||
ArrowSprite:Load("gfx/icons.anm2", true)
|
||||
ArrowSprite:Play("Arrow", false)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<AnimatedActor>
|
||||
<Info CreatedBy="Unknown" CreatedOn="10.09.2020 00:15:24" Version="50" Fps="30"/>
|
||||
<Info CreatedBy="Unknown" CreatedOn="05.11.2020 22:08:32" Version="51" Fps="30"/>
|
||||
<Content>
|
||||
<Spritesheets>
|
||||
<Spritesheet Path="eid_inline_icons.png" Id="0"/>
|
||||
<Spritesheet Path="eid_inline_icons.png" Id="1"/>
|
||||
</Spritesheets>
|
||||
<Layers>
|
||||
<Layer Name="1" Id="0" SpritesheetId="0"/>
|
||||
<Layer Name="replaceable" Id="1" SpritesheetId="1"/>
|
||||
</Layers>
|
||||
<Nulls/>
|
||||
<Events/>
|
||||
@@ -31,6 +33,7 @@
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="67" YCrop="0" Width="7" Height="7" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="75" YCrop="0" Width="7" Height="7" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -43,6 +46,7 @@
|
||||
<LayerAnimation LayerId="0" Visible="true">
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="0" YCrop="32" Width="11" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -70,6 +74,7 @@
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="66" YCrop="21" Width="11" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="77" YCrop="21" Width="11" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -82,6 +87,7 @@
|
||||
<LayerAnimation LayerId="0" Visible="true">
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="12" YCrop="32" Width="8" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -94,6 +100,7 @@
|
||||
<LayerAnimation LayerId="0" Visible="true">
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="23" YCrop="32" Width="8" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -106,6 +113,7 @@
|
||||
<LayerAnimation LayerId="0" Visible="true">
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="36" YCrop="32" Width="4" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -127,6 +135,7 @@
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="88" YCrop="43" Width="9" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="99" YCrop="43" Width="8" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -157,6 +166,7 @@
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="99" YCrop="67" Width="8" Height="9" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="110" YCrop="67" Width="9" Height="9" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -169,6 +179,7 @@
|
||||
<LayerAnimation LayerId="0" Visible="true">
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="22" YCrop="68" Width="7" Height="7" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -181,6 +192,7 @@
|
||||
<LayerAnimation LayerId="0" Visible="true">
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="33" YCrop="68" Width="9" Height="9" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -193,6 +205,7 @@
|
||||
<LayerAnimation LayerId="0" Visible="true">
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="44" YCrop="68" Width="7" Height="7" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
@@ -216,6 +229,20 @@
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="111" YCrop="78" Width="10" Height="10" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="122" YCrop="78" Width="10" Height="10" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
<LayerAnimation LayerId="1" Visible="true"/>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
</Animation>
|
||||
<Animation Name="ItemIcon" FrameNum="1" Loop="false">
|
||||
<RootAnimation>
|
||||
<Frame XPosition="0" YPosition="0" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</RootAnimation>
|
||||
<LayerAnimations>
|
||||
<LayerAnimation LayerId="0" Visible="true"/>
|
||||
<LayerAnimation LayerId="1" Visible="true">
|
||||
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="0" YCrop="0" Width="32" Height="32" XScale="50" YScale="50" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
|
||||
</LayerAnimation>
|
||||
</LayerAnimations>
|
||||
<NullAnimations/>
|
||||
<Triggers/>
|
||||
|
||||
Reference in new issue
Block a user