Merge branch 'master' of https://github.com/kohashiwakaba/External-Item-Descriptions
This commit is contained in:
commit
cc0480ab2a
9 files changed
+142
-46
No files matched your search
@@ -16,7 +16,7 @@ EID.descriptions[languageCode].custom = {} -- table for custom entity descriptio
|
|||||||
EID.descriptions[languageCode].languageName = "English"
|
EID.descriptions[languageCode].languageName = "English"
|
||||||
|
|
||||||
-- Fonts to be used with this language pack
|
-- Fonts to be used with this language pack
|
||||||
EID.descriptions[languageCode].fonts = {{name="default", lineHeight=11}, {name="inverted", lineHeight=11}, {name="borderless", lineHeight=11}}
|
EID.descriptions[languageCode].fonts = {{name="default", lineHeight=11, textboxWidth = 115}, {name="inverted", lineHeight=11, textboxWidth = 115}, {name="borderless", lineHeight=11, textboxWidth = 115}}
|
||||||
|
|
||||||
---------- Collectibles ----------
|
---------- Collectibles ----------
|
||||||
EID.descriptions[languageCode].collectibles={
|
EID.descriptions[languageCode].collectibles={
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ EID.descriptions[languageCode].languageName = "Korean"
|
|||||||
|
|
||||||
korean_galmoori9, korean_galmoori11 is added for community request.
|
korean_galmoori9, korean_galmoori11 is added for community request.
|
||||||
]]
|
]]
|
||||||
EID.descriptions[languageCode].fonts = {{name="korean_hcrdotum", lineHeight=11}, {name="korean_lanapixel", lineHeight=12}, {name="korean_soyakkoma", lineHeight=13}, {name="korean_soyakkoma_borderless", lineHeight=13}, {name="korean_soyakkoma_inverted", lineHeight=13}, {name="korean_soyanon", lineHeight=12}, {name="korean_galmoori9", lineHeight=12}, {name="korean_galmoori11", lineHeight=14}}
|
EID.descriptions[languageCode].fonts = {{name="korean_hcrdotum", lineHeight=11, textboxWidth = 115}, {name="korean_lanapixel", lineHeight=12, textboxWidth = 115}, {name="korean_soyakkoma", lineHeight=13, textboxWidth = 115}, {name="korean_soyakkoma_borderless", lineHeight=13, textboxWidth = 115}, {name="korean_soyakkoma_inverted", lineHeight=13, textboxWidth = 115}, {name="korean_soyanon", lineHeight=12, textboxWidth = 115}, {name="korean_galmoori9", lineHeight=12, textboxWidth = 115}, {name="korean_galmoori11", lineHeight=14, textboxWidth = 115}}
|
||||||
|
|
||||||
---------- Collectibles ----------
|
---------- Collectibles ----------
|
||||||
EID.descriptions[languageCode].collectibles={
|
EID.descriptions[languageCode].collectibles={
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ EID.descriptions[languageCode].custom = {} -- table for custom entity descriptio
|
|||||||
EID.descriptions[languageCode].languageName = "Chinese"
|
EID.descriptions[languageCode].languageName = "Chinese"
|
||||||
|
|
||||||
-- Fonts to be used with this languagepack
|
-- Fonts to be used with this languagepack
|
||||||
EID.descriptions[languageCode].fonts = {{name = "default_cn", lineHeight = 14}}
|
EID.descriptions[languageCode].fonts = {{name = "default_cn", lineHeight = 14, textboxWidth = 150}}
|
||||||
|
|
||||||
---------- Collectibles ----------
|
---------- Collectibles ----------
|
||||||
EID.descriptions[languageCode].collectibles={
|
EID.descriptions[languageCode].collectibles={
|
||||||
|
|||||||
+11
-11
@@ -971,22 +971,22 @@ EID.descriptions[languageCode].GlitchedItemText = {
|
|||||||
[0] = "Damage", "Fire Rate", "Shot Speed", "Range", "Speed", "Tear Effects", "Tear Color", "Flight", "Attack Type", "Familiars", "Luck", "Size", "Color", "Chest Contents", [16] = "All Stats",
|
[0] = "Damage", "Fire Rate", "Shot Speed", "Range", "Speed", "Tear Effects", "Tear Color", "Flight", "Attack Type", "Familiars", "Luck", "Size", "Color", "Chest Contents", [16] = "All Stats",
|
||||||
|
|
||||||
-- Attribute triggers
|
-- Attribute triggers
|
||||||
chain = "{{ColorCyan}}Then:{{CR}} ",
|
chain = "Then:{{CR}} ",
|
||||||
active = "{{ColorCyan}}On use:#",
|
active = "On use:#",
|
||||||
pickup_collected = "{{ColorCyan}}When you collect a pickup:#", --chance to?
|
pickup_collected = "When you collect a pickup:#", --chance to?
|
||||||
enemy_kill = "{{ColorCyan}}On kill, chance to:#",
|
enemy_kill = "On kill, chance to:#",
|
||||||
damage_taken = "{{ColorCyan}}When you take damage:#", --chance to?
|
damage_taken = "When you take damage:#", --chance to?
|
||||||
entity_spawned = "When a {{ColorCyan}}{T1}{{CR}} is spawned:#",
|
entity_spawned = "When a {T1} is spawned:#",
|
||||||
tear_fire = "{{ColorCyan}}When you fire a tear, chance to:#",
|
tear_fire = "When you fire a tear, chance to:#",
|
||||||
enemy_hit = "{{ColorCyan}}On hitting an enemy, chance to:#",
|
enemy_hit = "On hitting an enemy, chance to:#",
|
||||||
room_clear = "{{ColorCyan}}On room clear:#", --chance to?
|
room_clear = "On room clear:#", --chance to?
|
||||||
|
|
||||||
-- Attribute effects
|
-- Attribute effects
|
||||||
area_damage = "Deal {1} damage in an area around you",
|
area_damage = "Deal {1} damage in an area around you",
|
||||||
add_temporary_effect = "Gain {1} for the room",
|
add_temporary_effect = "Gain {1} for the room",
|
||||||
convert_entities = "Convert all {{ColorGray}}{1}{{CR}} in the room to {{ColorGray}}{2}{{CR}}",
|
convert_entities = "Convert all {1} in the room to {2}",
|
||||||
use_active_item = "Use {1}",
|
use_active_item = "Use {1}",
|
||||||
spawn_entity = "Spawn a {{ColorGray}}{1}{{CR}}",
|
spawn_entity = "Spawn a {1}",
|
||||||
fart = "Fart with size {1}",
|
fart = "Fart with size {1}",
|
||||||
|
|
||||||
-- Generic entity names not obtained from entities2.xml
|
-- Generic entity names not obtained from entities2.xml
|
||||||
|
|||||||
+94
-23
@@ -530,11 +530,7 @@ end
|
|||||||
-- Generates a string with the defined pixel-length using a custom 1px wide character
|
-- Generates a string with the defined pixel-length using a custom 1px wide character
|
||||||
-- This will only work for this specific custom font
|
-- This will only work for this specific custom font
|
||||||
function EID:generatePlaceholderString(length)
|
function EID:generatePlaceholderString(length)
|
||||||
local placeholder = ""
|
return string.rep("¤", length)
|
||||||
for i = 1, length do
|
|
||||||
placeholder = placeholder .. "¤"
|
|
||||||
end
|
|
||||||
return placeholder
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the inlineIcon object of a given Iconstring
|
-- Returns the inlineIcon object of a given Iconstring
|
||||||
@@ -720,29 +716,103 @@ end
|
|||||||
|
|
||||||
-- Fits a given string to a specific width
|
-- Fits a given string to a specific width
|
||||||
-- returns the string as a table of lines
|
-- returns the string as a table of lines
|
||||||
function EID:fitTextToWidth(str, textboxWidth)
|
function EID:fitTextToWidth(str, textboxWidth, breakUtf8Chars)
|
||||||
local formatedLines = {}
|
local formatedLines = {}
|
||||||
local curLength = 0
|
local curLength = 0
|
||||||
local text = ""
|
local text = {}
|
||||||
for word in string.gmatch(str, "([^%s]+)") do
|
|
||||||
local colorFiltered = EID:filterColorMarkup(word, EID:getTextColor())
|
|
||||||
local filteredWord = ""
|
|
||||||
for _, filtered in ipairs(colorFiltered) do
|
|
||||||
filteredWord = filteredWord .. filtered[1]
|
|
||||||
end
|
|
||||||
local strFiltered, spriteTable = EID:filterIconMarkup(filteredWord, 0, 0)
|
|
||||||
local wordLength = EID:getStrWidth(strFiltered)
|
|
||||||
|
|
||||||
if curLength + wordLength <= textboxWidth or curLength < 12 then
|
local cursor = 1
|
||||||
text = text .. word .. " "
|
local word_begin_index = 1
|
||||||
curLength = curLength + wordLength
|
|
||||||
else
|
local byte = string.byte -- for speed up
|
||||||
table.insert(formatedLines, text)
|
local sub = string.sub
|
||||||
text = word .. " "
|
local byte_space = string.byte(' ')
|
||||||
curLength = wordLength
|
|
||||||
|
while cursor <= #str do
|
||||||
|
-- ascii word: 0x0xxxxxxx
|
||||||
|
-- utf8 word (sequence): 0x11xxxxxx 0x10xxxxxx 0x10xxxxxx ... 0x10xxxxxx
|
||||||
|
-- see https://en.wikipedia.org/wiki/UTF-8
|
||||||
|
-- we can only break after space, or before 0x11xxxxxx
|
||||||
|
local can_break_after_cursor = false
|
||||||
|
local cur, next = byte(str,cursor), byte(str,cursor+1)
|
||||||
|
if
|
||||||
|
-- cond#1: we can break at the end of string
|
||||||
|
cursor == #str or
|
||||||
|
-- cond#2: we can break after space
|
||||||
|
cur == byte_space or
|
||||||
|
-- handle utf8 characters
|
||||||
|
(breakUtf8Chars and(
|
||||||
|
-- cond#3: we can break if the next character is 0x11xxxxxx
|
||||||
|
((next & 0xC0) == 0xC0) or
|
||||||
|
-- cond#4: we can also break if the current is 0x10xxxxxx while the next is ascii but not space
|
||||||
|
(((cur & 0xC0) == 0x80) and (next~= byte_space and (next & 0x80) == 0x00))
|
||||||
|
))
|
||||||
|
then
|
||||||
|
--[[
|
||||||
|
-------------------ascii only---------------
|
||||||
|
word will be separated by spaces.
|
||||||
|
wordA |wordB |wordC |^%@&Q%#^&#@!! |aksldj
|
||||||
|
↑
|
||||||
|
cond#2
|
||||||
|
we may break after every space.
|
||||||
|
spaces | | | | | |woops
|
||||||
|
↑
|
||||||
|
cond#2
|
||||||
|
-------------------UTF8 only----------------
|
||||||
|
word is 0x11xxxxxx followed by several 0x10xxxxxx until the next 0x11xxxxxx (not included)
|
||||||
|
你|好|,|世|界|!|↑|↑|↑|↑
|
||||||
|
↑
|
||||||
|
cond#3
|
||||||
|
byte data of a word:
|
||||||
|
[0x11xxxxxx,0x10xxxxxx,0x10xxxxxx, (next is 0x11xxxxxx, cond#3)]
|
||||||
|
--------------------ascii->utf8------------
|
||||||
|
utf8 word must start with 0x11xxxxxx, so cond#3 split before it.
|
||||||
|
word|世|界
|
||||||
|
| ↑
|
||||||
|
↑ cond#3
|
||||||
|
cond#3
|
||||||
|
|
||||||
|
world |means |世|界
|
||||||
|
↑
|
||||||
|
cond#2
|
||||||
|
-------------------utf8->ascii--------------
|
||||||
|
世|界|是|world
|
||||||
|
| ↑
|
||||||
|
↑ cond#4
|
||||||
|
cond#3
|
||||||
|
世|界|是 |world
|
||||||
|
| ↑
|
||||||
|
↑ cond#2
|
||||||
|
cond#3
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- we can break after str[cursor]
|
||||||
|
local word = sub(str, word_begin_index, cursor)
|
||||||
|
|
||||||
|
local colorFiltered = EID:filterColorMarkup(word, EID:getTextColor())
|
||||||
|
local filteredWord = {}
|
||||||
|
for _, filtered in ipairs(colorFiltered) do
|
||||||
|
table.insert(filteredWord, filtered[1])
|
||||||
|
end
|
||||||
|
local strFiltered, spriteTable = EID:filterIconMarkup(table.concat(filteredWord), 0, 0)
|
||||||
|
local wordLength = EID:getStrWidth(strFiltered)
|
||||||
|
|
||||||
|
if curLength + wordLength <= textboxWidth or curLength < 12 then
|
||||||
|
table.insert(text, word)
|
||||||
|
curLength = curLength + wordLength
|
||||||
|
else
|
||||||
|
table.insert(formatedLines, table.concat(text))
|
||||||
|
text = { word }
|
||||||
|
curLength = wordLength
|
||||||
|
end
|
||||||
|
|
||||||
|
-- next word starts here
|
||||||
|
word_begin_index = cursor + 1
|
||||||
end
|
end
|
||||||
|
cursor = cursor + 1
|
||||||
end
|
end
|
||||||
table.insert(formatedLines, text)
|
|
||||||
|
table.insert(formatedLines, table.concat(text))
|
||||||
return formatedLines
|
return formatedLines
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1041,6 +1111,7 @@ function EID:fixDefinedFont()
|
|||||||
end
|
end
|
||||||
EID.Config["FontType"] = EID.descriptions[curLang].fonts[1].name
|
EID.Config["FontType"] = EID.descriptions[curLang].fonts[1].name
|
||||||
EID.lineHeight = EID.descriptions[curLang].fonts[1].lineHeight
|
EID.lineHeight = EID.descriptions[curLang].fonts[1].lineHeight
|
||||||
|
EID.Config["TextboxWidth"] = EID.descriptions[curLang].fonts[1].textboxWidth
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -498,3 +498,7 @@ EID.GoldenTrinketData = {
|
|||||||
-- Lil Clot, Swallowed M80, The Twins (default text), Cricket Leg (17%, 1 in 6), Apollyon's Best Friend, Broken Glasses
|
-- Lil Clot, Swallowed M80, The Twins (default text), Cricket Leg (17%, 1 in 6), Apollyon's Best Friend, Broken Glasses
|
||||||
[176] = 1, [178] = {t={50},mult=2}, [183] = 0, [185] = 17, [186] = 1, [187] = {t={50,50}, mult=2},
|
[176] = 1, [178] = {t={50},mult=2}, [183] = 0, [185] = 17, [186] = 1, [187] = {t={50,50}, mult=2},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EID.BreakUtf8CharsLanguage = {
|
||||||
|
['zh_cn'] = true
|
||||||
|
}
|
||||||
+19
-4
@@ -20,6 +20,18 @@ local logLocation = os.getenv("SYSTEMDRIVE") .. "/Users/" .. os.getenv("USERNAME
|
|||||||
local logFound = false
|
local logFound = false
|
||||||
local logCursor = 0
|
local logCursor = 0
|
||||||
|
|
||||||
|
local triggerColors = {
|
||||||
|
chain = "{{ColorSilver}}",
|
||||||
|
active = "{{ColorLime}}",
|
||||||
|
pickup_collected = "{{ColorYellow}}",
|
||||||
|
enemy_kill = "{{ColorRed}}",
|
||||||
|
damage_taken = "{{ColorRed}}",
|
||||||
|
entity_spawned = "",
|
||||||
|
tear_fire = "{{ColorCyan}}",
|
||||||
|
enemy_hit = "{{ColorEIDError}}",
|
||||||
|
room_clear = "{{ColorOrange}}",
|
||||||
|
}
|
||||||
|
|
||||||
local function entityToName(e, plural)
|
local function entityToName(e, plural)
|
||||||
local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
|
local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
|
||||||
-- -1 is often used as an "any of this type", even if there's only one of that type, so converting it to 0 can help find names
|
-- -1 is often used as an "any of this type", even if there's only one of that type, so converting it to 0 can help find names
|
||||||
@@ -31,7 +43,7 @@ local function entityToName(e, plural)
|
|||||||
if name == e then Isaac.DebugString("No name found for " .. e .. " (could be modded)")
|
if name == e then Isaac.DebugString("No name found for " .. e .. " (could be modded)")
|
||||||
elseif plural then name = name .. localizedNames["pluralize"] end
|
elseif plural then name = name .. localizedNames["pluralize"] end
|
||||||
|
|
||||||
return name
|
return "{{ColorGray}}" .. name .. "{{CR}}"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function parseEffectLine(raw)
|
local function parseEffectLine(raw)
|
||||||
@@ -77,7 +89,7 @@ local function parseEffectLine(raw)
|
|||||||
|
|
||||||
local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
|
local localizedNames = EID:getDescriptionEntry("GlitchedItemText")
|
||||||
local eidString = ""
|
local eidString = ""
|
||||||
if effectTrigger ~= lastEffectTrigger then eidString = eidString .. (localizedNames[effectTrigger] or (effectTrigger .. "#")) end
|
if effectTrigger ~= lastEffectTrigger then eidString = eidString .. triggerColors[effectTrigger] .. (localizedNames[effectTrigger] or (effectTrigger .. "#")) end
|
||||||
if printEffect then eidString = eidString .. (localizedNames[effectType] or fullEffect) .. "#" end
|
if printEffect then eidString = eidString .. (localizedNames[effectType] or fullEffect) .. "#" end
|
||||||
for k,v in ipairs(triggerReplacements) do eidString = string.gsub(eidString, "{T" .. k .. "}", v) end
|
for k,v in ipairs(triggerReplacements) do eidString = string.gsub(eidString, "{T" .. k .. "}", v) end
|
||||||
for k,v in ipairs(replacements) do eidString = string.gsub(eidString, "{" .. k .. "}", v) end
|
for k,v in ipairs(replacements) do eidString = string.gsub(eidString, "{" .. k .. "}", v) end
|
||||||
@@ -87,8 +99,11 @@ local function parseEffectLine(raw)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function CheckLogForItems(_)
|
local function CheckLogForItems(_)
|
||||||
if not EID.Config["DisplayGlitchedItemInfo"] or not logFound or game:GetFrameCount() % 5 ~= 0 or not EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_TMTRAINER) then return end
|
-- Check log.txt every 5 frames if there's a collectible we haven't read the data for yet
|
||||||
|
-- (Should work well for Corrupted Data)
|
||||||
|
if game:GetFrameCount() % 5 ~= 0 or not EID.Config["DisplayGlitchedItemInfo"] or not logFound or
|
||||||
|
Isaac.GetItemConfig():GetCollectible(maxNumber - spawnedItems - 1) == nil then return end
|
||||||
|
|
||||||
local numEffects = 0
|
local numEffects = 0
|
||||||
local itemScore = 0
|
local itemScore = 0
|
||||||
local eidDesc = ""
|
local eidDesc = ""
|
||||||
|
|||||||
@@ -323,10 +323,15 @@ if REPENTANCE then
|
|||||||
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInit, PickupVariant.PICKUP_COLLECTIBLE)
|
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, EID.postPickupInit, PickupVariant.PICKUP_COLLECTIBLE)
|
||||||
|
|
||||||
function EID:CheckPedestalIndex(entity)
|
function EID:CheckPedestalIndex(entity)
|
||||||
-- Only pedestals with indexes that were present at room load can be flip pedestals; fixes shop restock machines
|
-- Only pedestals with indexes that were present at room load can be flip pedestals
|
||||||
if EID.flipItemPositions[curRoomIndex] and EID.flipItemPositions[curRoomIndex][entity.InitSeed] and entity.Index > EID.flipMaxIndex then
|
-- Fixes shop restock machines and Diplopia... mostly. At least while you're in the room.
|
||||||
EID.flipItemPositions[curRoomIndex][entity.InitSeed] = nil
|
if entity:GetData()["EID_FlipItemID"] and entity.Index > EID.flipMaxIndex then
|
||||||
entity:GetData()["EID_FlipItemID"] = nil
|
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
||||||
|
local gridPos = game:GetRoom():GetGridIndex(entity.Position)
|
||||||
|
local flipEntry = EID.flipItemPositions[curRoomIndex] and EID.flipItemPositions[curRoomIndex][entity.InitSeed]
|
||||||
|
-- only wipe the data if the grid index matches (so Diplopia pedestals don't)
|
||||||
|
if flipEntry and gridPos == flipEntry[2] then EID.flipItemPositions[curRoomIndex][entity.InitSeed] = nil end
|
||||||
|
entity:GetData()["EID_FlipItemID"] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.CheckPedestalIndex, PickupVariant.PICKUP_COLLECTIBLE)
|
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.CheckPedestalIndex, PickupVariant.PICKUP_COLLECTIBLE)
|
||||||
@@ -512,7 +517,7 @@ function EID:printBulletPoints(description, renderPos)
|
|||||||
local textScale = Vector(EID.Scale, EID.Scale)
|
local textScale = Vector(EID.Scale, EID.Scale)
|
||||||
description = EID:replaceShortMarkupStrings(description)
|
description = EID:replaceShortMarkupStrings(description)
|
||||||
for line in string.gmatch(description, "([^#]+)") do
|
for line in string.gmatch(description, "([^#]+)") do
|
||||||
local formatedLines = EID:fitTextToWidth(line, textboxWidth)
|
local formatedLines = EID:fitTextToWidth(line, textboxWidth, EID.BreakUtf8CharsLanguage[EID.Config["Language"]])
|
||||||
local textColor = EID:getTextColor()
|
local textColor = EID:getTextColor()
|
||||||
for i, lineToPrint in ipairs(formatedLines) do
|
for i, lineToPrint in ipairs(formatedLines) do
|
||||||
-- render bulletpoint
|
-- render bulletpoint
|
||||||
|
|||||||
@@ -1014,6 +1014,7 @@ if MCMLoaded then
|
|||||||
OnChange = function(currentNum)
|
OnChange = function(currentNum)
|
||||||
EID.Config["FontType"] = fontNames[currentNum]
|
EID.Config["FontType"] = fontNames[currentNum]
|
||||||
EID.lineHeight = fonts[currentNum].lineHeight
|
EID.lineHeight = fonts[currentNum].lineHeight
|
||||||
|
EID.Config["TextboxWidth"] = fonts[currentNum].textboxWidth
|
||||||
EID:fixDefinedFont()
|
EID:fixDefinedFont()
|
||||||
local fontFile = EID.Config["FontType"] or "default"
|
local fontFile = EID.Config["FontType"] or "default"
|
||||||
EID:loadFont(EID.modPath .. "resources/font/eid_"..fontFile..".fnt")
|
EID:loadFont(EID.modPath .. "resources/font/eid_"..fontFile..".fnt")
|
||||||
|
|||||||
Reference in new issue
Block a user