fixed file formatting and code warnings
This commit is contained in:
1 parent
94e7d21e04
commit
f82bff5231
7 files changed
+142
-127
No files matched your search
@@ -321,10 +321,10 @@ function EID:calculateBagOfCrafting(componentsTable)
|
||||
end
|
||||
end
|
||||
|
||||
for i=1,20 do
|
||||
for i = 1, 20 do
|
||||
local t = nextFloat() -- random number between 0 and 1
|
||||
local target = t * totalWeight -- number between 0 and total weight of possible results
|
||||
for k,v in ipairs(itemWeights) do
|
||||
for k, v in ipairs(itemWeights) do
|
||||
target = target - v
|
||||
if target < 0 then
|
||||
-- check item:IsAvailable, otherwise reroll
|
||||
@@ -424,6 +424,7 @@ EID:AddCallback(ModCallbacks.MC_PRE_PICKUP_COLLISION, function(_, pickup,collide
|
||||
end)
|
||||
|
||||
-- Formerly a MC_POST_PICKUP_UPDATE, but moved to this so that it's only called when we own a bag
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function EID:BoCCheckForPickups()
|
||||
for _,pickup in ipairs(Isaac.FindByType(EntityType.ENTITY_PICKUP, -1, -1, false, false)) do
|
||||
if pickup:GetSprite():GetAnimation() == "Collect" and not pickupsCollected[pickup.Index] then
|
||||
@@ -462,6 +463,7 @@ end)
|
||||
--Tainted Cain "hold to craft" check
|
||||
local holdCounter = 0
|
||||
local icount = 0
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function EID:BoCTrackBagHolding()
|
||||
if not IsTaintedCain() then return end
|
||||
local isCardHold = Input.IsActionPressed(ButtonAction.ACTION_PILLCARD, EID.bagPlayer.ControllerIndex)
|
||||
@@ -495,6 +497,7 @@ local function shiftBagContent()
|
||||
EID.BoC.BagItems = newContent
|
||||
end
|
||||
-- only Tainted Cain's consumable slot bag can have its ingredients shifted
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function EID:BoCDetectBagContentShift()
|
||||
if Input.IsActionTriggered(ButtonAction.ACTION_DROP, EID.bagPlayer.ControllerIndex) and IsTaintedCain() then
|
||||
shiftBagContent()
|
||||
|
||||
@@ -152,8 +152,48 @@ local function jamoToCompJamo(code)
|
||||
return 0
|
||||
end
|
||||
|
||||
---@param tt "initial"|"medial"|"final"|"partialOnly"
|
||||
---@param char string
|
||||
---@return integer UnicodeChar
|
||||
local function getCode( tt, char )
|
||||
-- 초성 리스트 (initial list)
|
||||
local initial = { 'r','R','s','e','E','f','a','q','Q','t','T','d','w','W','c','z','x','v','g'};
|
||||
-- 중성 리스트 (medial list)
|
||||
local medial = { 'k', 'o', 'i', 'O', 'j', 'p', 'u', 'P', 'h', 'hk', 'ho', 'hl', 'y', 'n', 'nj', 'np', 'nl', 'b', 'm', 'ml', 'l' };
|
||||
-- 종성 리스트 (final list)
|
||||
local final = { 'r', 'R', 'rt', 's', 'sw', 'sg', 'e', 'f', 'fr', 'fa', 'fq', 'ft', 'fx', 'fv', 'fg', 'a', 'q', 'qt', 't', 'T', 'd', 'w', 'c', 'z', 'x', 'v', 'g' };
|
||||
local returnCode = 0; -- 최종 인덱스 (return index)
|
||||
local isFind = false; -- 발견 여부 (code found check)
|
||||
|
||||
-- 각 리스트에서 인덱스를 검색하기 위한 로컬 함수
|
||||
local find = function(tb, ch)
|
||||
for i = 1, #tb do
|
||||
if tb[i] == ch then
|
||||
returnCode = i-1;
|
||||
isFind = true;
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if char ~= nil then
|
||||
if tt == 'initial' then
|
||||
find( initial, char )
|
||||
returnCode = returnCode * 21 * 28
|
||||
elseif tt == 'medial' then
|
||||
find( medial, char )
|
||||
returnCode = returnCode * 28
|
||||
elseif tt == 'final' then
|
||||
find( final, char )
|
||||
returnCode = returnCode + 1
|
||||
end
|
||||
end
|
||||
if isFind == false then returnCode = -1; end
|
||||
return returnCode;
|
||||
end
|
||||
|
||||
---Converts 0x1101 like unicode to string
|
||||
---@param unicode_list UnicodeChar[]
|
||||
---@param unicode_list table
|
||||
---@return string convertedUnicodeChar
|
||||
local function conv2utf8(unicode_list)
|
||||
local result = ''
|
||||
@@ -161,7 +201,7 @@ local function conv2utf8(unicode_list)
|
||||
local function modulo(a, b)
|
||||
return a - math.floor(a/b) * b
|
||||
end
|
||||
for i,v in ipairs(unicode_list) do
|
||||
for _,v in ipairs(unicode_list) do
|
||||
if v ~= 0 and v ~= nil then
|
||||
if utf8 then
|
||||
-- Tested in REPENTOGON
|
||||
@@ -194,7 +234,7 @@ end
|
||||
|
||||
---converts single Korean word within string and index
|
||||
---@param text string
|
||||
---@param idx index
|
||||
---@param idx integer
|
||||
---@return string convertedKoreanWord
|
||||
---@return integer newIndex
|
||||
local function getFinalString(text, idx)
|
||||
@@ -239,7 +279,7 @@ local function getFinalString(text, idx)
|
||||
local secondP2 = text:sub( idx+1, idx+1 )
|
||||
local medialCodeP1 = getCode( 'medial', secondP1 ); -- 2 chars of medial position
|
||||
local medialCodeP2 = getCode( 'medial', secondP2 ); -- 1 char of medial position
|
||||
local medialCodeP3 = getCode( 'initial', secondP2 ); -- 1 char of medial position, but check for initial char
|
||||
--local medialCodeP3 = getCode( 'initial', secondP2 ); -- 1 char of medial position, but check for initial char
|
||||
|
||||
if medialCodeP1 ~= -1 then
|
||||
-- 2 word medials
|
||||
@@ -312,11 +352,6 @@ local function engToKor(msg)
|
||||
|
||||
local text = msg;
|
||||
|
||||
-- 한글의 초,중,종성의 인덱스
|
||||
local initialCode = 0;
|
||||
local medialCode = 0;
|
||||
local finalCode = 0;
|
||||
|
||||
-- 루프와 결과 저장을 위한 변수
|
||||
local textLength = #text
|
||||
local ret = "";
|
||||
@@ -330,44 +365,4 @@ local function engToKor(msg)
|
||||
return ret
|
||||
end
|
||||
|
||||
---@param tt "initial"|"medial"|"final"|"partialOnly"
|
||||
---@param char char
|
||||
---@return integer UnicodeChar
|
||||
function getCode( tt, char )
|
||||
-- 초성 리스트 (initial list)
|
||||
local initial = { 'r','R','s','e','E','f','a','q','Q','t','T','d','w','W','c','z','x','v','g'};
|
||||
-- 중성 리스트 (medial list)
|
||||
local medial = { 'k', 'o', 'i', 'O', 'j', 'p', 'u', 'P', 'h', 'hk', 'ho', 'hl', 'y', 'n', 'nj', 'np', 'nl', 'b', 'm', 'ml', 'l' };
|
||||
-- 종성 리스트 (final list)
|
||||
local final = { 'r', 'R', 'rt', 's', 'sw', 'sg', 'e', 'f', 'fr', 'fa', 'fq', 'ft', 'fx', 'fv', 'fg', 'a', 'q', 'qt', 't', 'T', 'd', 'w', 'c', 'z', 'x', 'v', 'g' };
|
||||
local returnCode = 0; -- 최종 인덱스 (return index)
|
||||
local isFind = false; -- 발견 여부 (code found check)
|
||||
|
||||
-- 각 리스트에서 인덱스를 검색하기 위한 로컬 함수
|
||||
local find = function(tb, ch)
|
||||
for i = 1, #tb do
|
||||
if tb[i] == ch then
|
||||
returnCode = i-1;
|
||||
isFind = true;
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if char ~= nil then
|
||||
if tt == 'initial' then
|
||||
find( initial, char )
|
||||
returnCode = returnCode * 21 * 28
|
||||
elseif tt == 'medial' then
|
||||
find( medial, char )
|
||||
returnCode = returnCode * 28
|
||||
elseif tt == 'final' then
|
||||
find( final, char )
|
||||
returnCode = returnCode + 1
|
||||
end
|
||||
end
|
||||
if isFind == false then returnCode = -1; end
|
||||
return returnCode;
|
||||
end
|
||||
|
||||
EID.engKeystrokeToKor = engToKor
|
||||
@@ -28,11 +28,11 @@ EID.collectiblesToCheck = {}
|
||||
Argument 5 (very optional): The position in the table to insert this new condition, in case mods want to insert modifiers before our base ones
|
||||
]]
|
||||
function EID:AddConditional(IDs, funcText, modText, extraTable, insertPoint)
|
||||
if type(IDs) ~= "table" then IDs = {IDs} end
|
||||
if type(IDs) ~= "table" then IDs = { IDs } end
|
||||
if modText == "" then modText = nil end
|
||||
extraTable = extraTable or {}
|
||||
-- make a shallow copy of the passed-in table
|
||||
local newTable = {}; for k,v in pairs(extraTable) do newTable[k] = v end
|
||||
local newTable = {}; for k, v in pairs(extraTable) do newTable[k] = v end
|
||||
newTable.func = funcText;
|
||||
newTable.modifierText = modText;
|
||||
if newTable.noFallback == nil then newTable.noFallback = true end
|
||||
@@ -42,8 +42,11 @@ function EID:AddConditional(IDs, funcText, modText, extraTable, insertPoint)
|
||||
local _, count = string.gsub(id, "%.", "")
|
||||
if count == 1 then newTable.general = true end
|
||||
EID.DescriptionConditions[id] = EID.DescriptionConditions[id] or {}
|
||||
if insertPoint then table.insert(EID.DescriptionConditions[id], insertPoint, newTable)
|
||||
else table.insert(EID.DescriptionConditions[id], newTable) end
|
||||
if insertPoint then
|
||||
table.insert(EID.DescriptionConditions[id], insertPoint, newTable)
|
||||
else
|
||||
table.insert(EID.DescriptionConditions[id], newTable)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,14 +55,15 @@ end
|
||||
|
||||
-- checkInReminder is for if a synergy is no longer relevant once the item isn't obtainable (e.g. Abyss locusts) (true by default)
|
||||
function EID:AddCollectibleConditional(IDs, ownedIDs, modText, extraTable, checkInReminder)
|
||||
if type(ownedIDs) ~= "table" then ownedIDs = {ownedIDs} end
|
||||
if type(ownedIDs) ~= "table" then ownedIDs = { ownedIDs } end
|
||||
if checkInReminder == nil then checkInReminder = true end
|
||||
extraTable = extraTable or {}
|
||||
for _, ownedID in ipairs(ownedIDs) do
|
||||
EID.collectiblesToCheck[ownedID] = true
|
||||
if extraTable.variableText == nil then extraTable.variableText = "{{NameOnlyC" .. ownedID .. "}}" end
|
||||
if extraTable.bulletpoint == nil then extraTable.bulletpoint = "Collectible" .. ownedID end
|
||||
EID:AddConditional(IDs, function() return EID:ConditionalCollCheck(ownedID,checkInReminder) end, modText, extraTable)
|
||||
EID:AddConditional(IDs, function() return EID:ConditionalCollCheck(ownedID, checkInReminder) end, modText,
|
||||
extraTable)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,13 +76,14 @@ end
|
||||
|
||||
-- includeTainted is for if you want to check the normal and tainted version of a character (true by default)
|
||||
function EID:AddPlayerConditional(IDs, charIDs, modText, extraTable, includeTainted)
|
||||
if type(charIDs) ~= "table" then charIDs = {charIDs} end
|
||||
if type(charIDs) ~= "table" then charIDs = { charIDs } end
|
||||
if includeTainted == nil then includeTainted = true end
|
||||
extraTable = extraTable or {}
|
||||
for _, charID in ipairs(charIDs) do
|
||||
if extraTable.variableText == nil then extraTable.variableText = "{{NameOnlyI" .. charID .. "}}" end
|
||||
if extraTable.bulletpoint == nil then extraTable.bulletpoint = "Player" .. charID end
|
||||
EID:AddConditional(IDs, function() return EID:ConditionalCharCheck(charID,includeTainted) end, modText, extraTable)
|
||||
EID:AddConditional(IDs, function() return EID:ConditionalCharCheck(charID, includeTainted) end, modText,
|
||||
extraTable)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -124,24 +129,25 @@ EID:AddConditional("5.300.15", function() return game:IsGreedMode() and EID:Play
|
||||
|
||||
-- Different effect for No Red Health players
|
||||
-- TODO: separate this into a Rep-only part, and figure out what they do exactly with Keeper/Forgotten
|
||||
EID:AddConditional({442, 676}, function() return EID:CheckForNoRedHealthPlayer() end, "No Red") -- Dark Prince's Crown, Empty Heart
|
||||
EID:AddConditional(81, function() return EID:CheckForNoRedHealthPlayer() end) -- Dead Cat
|
||||
EID:AddConditional({ 442, 676 }, function() return EID:CheckForNoRedHealthPlayer() end, "No Red") -- Dark Prince's Crown, Empty Heart
|
||||
EID:AddConditional(81, function() return EID:CheckForNoRedHealthPlayer() end) -- Dead Cat
|
||||
--TODO: Keeper/Forgotten DON'T benefit from Empty Heart but DO benefit from Dark Prince's Crown? Nothing's consistent... does the Soul benefit while Forgotten does
|
||||
|
||||
-- Achievement checks (these always return true without REPENTOGON)
|
||||
EID:AddConditional("5.350.23", function() return EID:HaveNotUnlockedAchievement(82) end) -- Sacrifice Poster unlocks The Lost
|
||||
|
||||
-- Specific character synergies/changes
|
||||
EID:AddPlayerConditional(549, {10,14})-- Keeper/Lost + Brittle Bones
|
||||
EID:AddPlayerConditional(108, 14, "No Effect") -- Keeper + The Wafer
|
||||
EID:AddPlayerConditional(549, { 10, 14 }) -- Keeper/Lost + Brittle Bones
|
||||
EID:AddPlayerConditional(108, 14, "No Effect") -- Keeper + The Wafer
|
||||
EID:AddPlayerConditional(227, 14, "Keeper 0-1") -- Keeper + Piggy Bank
|
||||
EID:AddPlayerConditional(501, 14) -- Keeper + Greed's Gullet
|
||||
EID:AddPlayerConditional(230, 14, "Keeper") -- Keeper + Abaddon
|
||||
EID:AddPlayerConditional(501, 14) -- Keeper + Greed's Gullet
|
||||
EID:AddPlayerConditional(230, 14, "Keeper") -- Keeper + Abaddon
|
||||
|
||||
-- Item Synergies
|
||||
EID:AddSynergyConditional(7, 34); EID:AddCollectibleConditional("5.300.16", 7) -- Martyr + Book of Belial/The Devil
|
||||
EID:AddSynergyConditional(316, 260) -- Black Candle + Cursed Eye
|
||||
EID:AddCollectibleConditional("5.300.48", 286, nil, {lineColor = "ColorSilver"}) -- Blank Card + ? Card
|
||||
EID:AddSynergyConditional(7, 34) -- Martyr + Book of Belial/The Devil
|
||||
EID:AddCollectibleConditional("5.300.16", 7) -- Martyr + Book of Belial/The Devil
|
||||
EID:AddSynergyConditional(316, 260) -- Black Candle + Cursed Eye
|
||||
EID:AddCollectibleConditional("5.300.48", 286, nil, { lineColor = "ColorSilver" }) -- Blank Card + ? Card
|
||||
|
||||
-- Overridden by Brimstone
|
||||
-- Haven't done it yet but I'm sure preparing the system for it
|
||||
@@ -150,36 +156,36 @@ EID:AddCollectibleConditional("5.300.48", 286, nil, {lineColor = "ColorSilver"})
|
||||
|
||||
if EID.isRepentance then
|
||||
-- General conditions
|
||||
EID:AddCollectibleConditional("5.100", 706, nil, {locTable = "abyssSynergies", lineColor = "ColorRed"}, false) -- Abyss (no item reminder)
|
||||
EID:AddCollectibleConditional("5.100", 59, nil, {locTable = "bookOfBelialBuffs"}) -- Belial Birthright
|
||||
EID:AddCollectibleConditional("5.100", 664, nil, {locTable = "bingeEaterBuffs"}) -- Binge Eater
|
||||
|
||||
EID:AddCollectibleConditional("5.100", 706, nil, { locTable = "abyssSynergies", lineColor = "ColorRed" }, false) -- Abyss (no item reminder)
|
||||
EID:AddCollectibleConditional("5.100", 59, nil, { locTable = "bookOfBelialBuffs" }) -- Belial Birthright
|
||||
EID:AddCollectibleConditional("5.100", 664, nil, { locTable = "bingeEaterBuffs" }) -- Binge Eater
|
||||
|
||||
-- Co-op friendly items
|
||||
-- todo (yum heart, extension cord)
|
||||
|
||||
|
||||
-- Tainted characters reviving as themselves
|
||||
EID:AddPlayerConditional({161, "5.350.28"}, 25, "Tainted Revive") -- Ankh, Broken Ankh
|
||||
EID:AddPlayerConditional(311, 24, "Tainted Revive") -- Judas's Shadow
|
||||
EID:AddPlayerConditional(332, {29, 38}, "Tainted Revive") -- Lazarus's Rags
|
||||
EID:AddPlayerConditional("5.350.23", 31, "Tainted Revive") -- Sacrifice Poster
|
||||
EID:AddPlayerConditional({ 161, "5.350.28" }, 25, "Tainted Revive") -- Ankh, Broken Ankh
|
||||
EID:AddPlayerConditional(311, 24, "Tainted Revive") -- Judas's Shadow
|
||||
EID:AddPlayerConditional(332, { 29, 38 }, "Tainted Revive") -- Lazarus's Rags
|
||||
EID:AddPlayerConditional("5.350.23", 31, "Tainted Revive") -- Sacrifice Poster
|
||||
|
||||
-- Specific character synergies/changes
|
||||
EID:AddPlayerConditional("5.350.1", 14, "Keeper 0-1") -- Keeper + Swallowed Penny
|
||||
EID:AddPlayerConditional(188, 2) -- Cain + Abel
|
||||
EID:AddPlayerConditional(360, 13) -- Incubus + Lilith
|
||||
EID:AddPlayerConditional({240, 644}, 21) -- Tainted Isaac + Experimental Treatment, Consolation Prize
|
||||
EID:AddPlayerConditional({642, 694}, 10) -- Lost + Magic Skin, Heartbreak
|
||||
EID:AddPlayerConditional("5.350.156", 14) -- Keeper + Mother's Kiss
|
||||
EID:AddPlayerConditional(188, 2) -- Cain + Abel
|
||||
EID:AddPlayerConditional(360, 13) -- Incubus + Lilith
|
||||
EID:AddPlayerConditional({ 240, 644 }, 21) -- Tainted Isaac + Experimental Treatment, Consolation Prize
|
||||
EID:AddPlayerConditional({ 642, 694 }, 10) -- Lost + Magic Skin, Heartbreak
|
||||
EID:AddPlayerConditional("5.350.156", 14) -- Keeper + Mother's Kiss
|
||||
EID:AddPlayerConditional(230, 18, "Bethany", nil, false) -- Bethany + Abaddon
|
||||
EID:AddPlayerConditional(230, 36, "Tainted Bethany") -- Tainted Bethany + Abaddon
|
||||
EID:AddPlayerConditional(245, 14, "Keeper") -- 20/20 + Keeper
|
||||
EID:AddPlayerConditional(705, {12, 24}) -- Dark Arts + Dark/Tainted Judas
|
||||
|
||||
EID:AddPlayerConditional(230, 36, "Tainted Bethany") -- Tainted Bethany + Abaddon
|
||||
EID:AddPlayerConditional(245, 14, "Keeper") -- 20/20 + Keeper
|
||||
EID:AddPlayerConditional(705, { 12, 24 }) -- Dark Arts + Dark/Tainted Judas
|
||||
|
||||
-- Item Synergies
|
||||
EID:AddCollectibleConditional(201, 147) -- Iron Bar refills Notched Axe
|
||||
EID:AddCollectibleConditional("5.350.172", 260) -- Black Candle + Cursed Penny
|
||||
EID:AddCollectibleConditional(501, 416) -- Greed's Gullet + Deep Pockets
|
||||
EID:AddSynergyConditional(245, {2, 153, 169}, nil, "20/20") -- 20/20 + Mutant Spider, The Inner Eye, Polyphemus
|
||||
EID:AddCollectibleConditional(201, 147) -- Iron Bar refills Notched Axe
|
||||
EID:AddCollectibleConditional("5.350.172", 260) -- Black Candle + Cursed Penny
|
||||
EID:AddCollectibleConditional(501, 416) -- Greed's Gullet + Deep Pockets
|
||||
EID:AddSynergyConditional(245, { 2, 153, 169 }, nil, "20/20") -- 20/20 + Mutant Spider, The Inner Eye, Polyphemus
|
||||
EID:AddSynergyConditional(330, 561, "Overridden", "Overrides") -- Soy+Almond Milk
|
||||
end
|
||||
|
||||
@@ -189,13 +195,18 @@ function EID:ConditionalCharCheck(playerType, includeTainted)
|
||||
-- We don't want to display irrelevant item info inside the Item Reminder
|
||||
if EID.InsideItemReminder then
|
||||
local player = EID:ItemReminderGetAllPlayers()[EID.ItemReminderSelectedPlayer + 1] or EID.player
|
||||
if player:GetPlayerType() == playerType then return true
|
||||
elseif includeTainted and EID.isRepentance and Isaac.GetPlayerTypeByName(player:GetName()) == playerType then return true
|
||||
else return false end
|
||||
if player:GetPlayerType() == playerType then
|
||||
return true
|
||||
elseif includeTainted and EID.isRepentance and Isaac.GetPlayerTypeByName(player:GetName()) == playerType then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
else
|
||||
return EID:PlayersHaveCharacter(playerType, includeTainted)
|
||||
end
|
||||
end
|
||||
|
||||
function EID:ConditionalCollCheck(collectibleID, checkInReminder)
|
||||
-- We don't want to display irrelevant item info inside the Item Reminder
|
||||
if EID.InsideItemReminder then
|
||||
@@ -218,9 +229,13 @@ end
|
||||
function EID:IsGreedMode()
|
||||
return game:IsGreedMode()
|
||||
end
|
||||
|
||||
function EID:IsHardMode()
|
||||
if game.Difficulty == 1 or game.Difficulty == 3 then return true
|
||||
else return false end
|
||||
if game.Difficulty == 1 or game.Difficulty == 3 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if we have any characters that can't have Red Health, to print additions to descs like Dead Cat
|
||||
@@ -249,6 +264,7 @@ function EID:HaveEncountered(monsterType, monsterVariant)
|
||||
if not REPENTOGON then return true end
|
||||
return Isaac.GetPersistentGameData():GetBestiaryEncounterCount(monsterType, monsterVariant) > 0
|
||||
end
|
||||
|
||||
function EID:HaveNotEncountered(monsterType, monsterVariant)
|
||||
if not REPENTOGON then return true end
|
||||
return not EID:HaveEncountered(monsterType, monsterVariant)
|
||||
@@ -264,39 +280,38 @@ function EID:HaveNotUnlockedAchievement(achID)
|
||||
return not EID:HaveUnlockedAchievement(achID)
|
||||
end
|
||||
|
||||
|
||||
----- Apply Conditionals -----
|
||||
|
||||
-- thing to fix find/replace pairs with hyphens (like "1-2") breaking because hyphen is a special char
|
||||
-- https://stackoverflow.com/questions/29072601/lua-string-gsub-with-a-hyphen
|
||||
local function replace(str, what, with, count)
|
||||
what = string.gsub(what, "[%(%)%.%+%-%*%?%[%]%^%$%%]", "%%%1") -- escape pattern
|
||||
with = string.gsub(with, "[%%]", "%%%%") -- escape replacement
|
||||
return string.gsub(str, what, with, count)
|
||||
what = string.gsub(what, "[%(%)%.%+%-%*%?%[%]%^%$%%]", "%%%1") -- escape pattern
|
||||
with = string.gsub(with, "[%%]", "%%%%") -- escape replacement
|
||||
return string.gsub(str, what, with, count)
|
||||
end
|
||||
-- super simple table concatenation: https://www.tutorialspoint.com/concatenation-of-tables-in-lua-programming
|
||||
local function TableConcat(t1,t2)
|
||||
for i=1,#t2 do
|
||||
t1[#t1+1] = t2[i]
|
||||
end
|
||||
return t1
|
||||
local function TableConcat(t1, t2)
|
||||
for i = 1, #t2 do
|
||||
t1[#t1 + 1] = t2[i]
|
||||
end
|
||||
return t1
|
||||
end
|
||||
|
||||
function EID:applyConditionals(descObj)
|
||||
EID:CheckPlayersCollectibles()
|
||||
|
||||
|
||||
local typeVar = descObj.ObjType.."."..descObj.ObjVariant -- for general conditions (Tarot Cloth, Book of Virtues)
|
||||
local typeVarSub = descObj.fullItemString -- for specific conditions
|
||||
-- Combine general+specific conditions into one table
|
||||
local conds = {}
|
||||
if EID.DescriptionConditions[typeVar] then TableConcat(conds, EID.DescriptionConditions[typeVar]) end
|
||||
if EID.DescriptionConditions[typeVarSub] then TableConcat(conds, EID.DescriptionConditions[typeVarSub]) end
|
||||
if EID.DescriptionConditions[typeVarSub] then TableConcat(conds, EID.DescriptionConditions[typeVarSub]) end
|
||||
-- Check every condition we need to check for this item
|
||||
for _, cond in ipairs(conds) do
|
||||
-- Search for the localization string; "S" (for generals) or "T.V.S" or "T.V.S (Modifier)" or "Modifier"
|
||||
local locTable = cond.locTable or "ConditionalDescs"
|
||||
local text = nil
|
||||
|
||||
|
||||
if cond.noTable then
|
||||
text = EID:getDescriptionEntry(cond.modifierText, nil, cond.noFallback)
|
||||
elseif cond.general then
|
||||
@@ -307,12 +322,14 @@ function EID:applyConditionals(descObj)
|
||||
else
|
||||
text = EID:getDescriptionEntry(locTable, typeVarSub, cond.noFallback)
|
||||
end
|
||||
|
||||
|
||||
-- If we find the localization string for this condition, and it passes the test, modify the description text
|
||||
if text ~= nil and cond.func() then
|
||||
local variableText = type(cond.variableText) == "function" and cond.variableText(descObj) or cond.variableText
|
||||
local variableText2 = type(cond.variableText2) == "function" and cond.variableText2(descObj) or cond.variableText2
|
||||
|
||||
local variableText = type(cond.variableText) == "function" and cond.variableText(descObj) or
|
||||
cond.variableText
|
||||
local variableText2 = type(cond.variableText2) == "function" and cond.variableText2(descObj) or
|
||||
cond.variableText2
|
||||
|
||||
-- String = append
|
||||
if type(text) == "string" then
|
||||
text = EID:ReplaceVariableStr(text, 1, variableText)
|
||||
@@ -320,19 +337,20 @@ function EID:applyConditionals(descObj)
|
||||
local iconStr = "#"
|
||||
if cond.bulletpoint then iconStr = iconStr .. "{{" .. cond.bulletpoint .. "}} " end
|
||||
if cond.lineColor then iconStr = iconStr .. "{{" .. cond.lineColor .. "}}" end
|
||||
EID:appendToDescription(descObj, iconStr..text:gsub("#",iconStr))
|
||||
|
||||
-- Table with 1 entry = replace
|
||||
EID:appendToDescription(descObj, iconStr .. text:gsub("#", iconStr))
|
||||
|
||||
-- Table with 1 entry = replace
|
||||
elseif #text == 1 then
|
||||
descObj.Description = EID:ReplaceVariableStr(EID:ReplaceVariableStr(text[1], 1, variableText), 2, variableText2)
|
||||
|
||||
-- Table with 2+ entries = find and replace pairs
|
||||
-- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc.
|
||||
descObj.Description = EID:ReplaceVariableStr(EID:ReplaceVariableStr(text[1], 1, variableText), 2,
|
||||
variableText2)
|
||||
|
||||
-- Table with 2+ entries = find and replace pairs
|
||||
-- Entry 1 is replaced with entry 2, entry 3 is replaced with entry 4, etc.
|
||||
else
|
||||
local pos = 1
|
||||
while pos < #text do
|
||||
local toFind = text[pos]
|
||||
local replaceWith = EID:ReplaceVariableStr(text[pos+1], 1, variableText)
|
||||
local replaceWith = EID:ReplaceVariableStr(text[pos + 1], 1, variableText)
|
||||
replaceWith = EID:ReplaceVariableStr(replaceWith, 2, variableText2)
|
||||
if cond.replaceColor then replaceWith = "{{" .. cond.replaceColor .. "}}" .. replaceWith .. "{{CR}}" end
|
||||
--"%d*%.?%d+" will grab every number group (1, 10, 0.5), this will allow us to not replace the "1" in "10" erroneously
|
||||
@@ -344,7 +362,7 @@ function EID:applyConditionals(descObj)
|
||||
return replaceWith
|
||||
end
|
||||
end)
|
||||
-- Basic find+replace for non-numbers
|
||||
-- Basic find+replace for non-numbers
|
||||
else
|
||||
descObj.Description = replace(descObj.Description, tostring(toFind), replaceWith, 1)
|
||||
end
|
||||
@@ -354,6 +372,5 @@ function EID:applyConditionals(descObj)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return descObj
|
||||
end
|
||||
@@ -32,7 +32,7 @@ for _,lang in ipairs(languageFilesToCheck) do
|
||||
print("Type mismatch in table '" .. prevKey .. "', key: " .. k)
|
||||
progress[2] = progress[2] + 1
|
||||
elseif type(table2[k]) == "table" then
|
||||
EID:compareTables(table1[k], table2[k], k, progress) end
|
||||
EID:compareTables(table1[k], table2[k], k, progress)
|
||||
else
|
||||
-- check for broken markup stuff
|
||||
local filteredText = EID:replaceShortMarkupStrings(table2[k])
|
||||
|
||||
@@ -242,7 +242,7 @@ function EID:VoidRoomCheck()
|
||||
local pickup = entity:ToPickup()
|
||||
-- Count this pedestal if it's not an active (or this is Black Rune), not a shop item, and (in Repentance) the first of its option index
|
||||
-- TEST IF VOID ALWAYS ABSORBS THE FIRST OF ITS OPTION INDEX
|
||||
if entity.SubType > 0 and not pickup:IsShopItem() and
|
||||
if pickup and entity.SubType > 0 and not pickup:IsShopItem() and
|
||||
(not EID.isRepentance or pickup.OptionsPickupIndex == 0 or EID.VoidOptionIndexes[pickup.OptionsPickupIndex] == nil) then
|
||||
numRunable = numRunable + 1
|
||||
if EID.isRepentance then EID.VoidOptionIndexes[pickup.OptionsPickupIndex] = entity.SubType end
|
||||
|
||||
@@ -554,7 +554,7 @@ if EID.isRepentance then
|
||||
VariableCharge(descObj, EID.cardMetadata[descObj.ObjSubType], 286, "BlankCardCharge")
|
||||
-- If the player has Tarot Cloth and Blank Card, display additional text
|
||||
if hasTarot then
|
||||
text = EID:getDescriptionEntry("BlankCardEffect")
|
||||
local text = EID:getDescriptionEntry("BlankCardEffect")
|
||||
local buffText = EID:getDescriptionEntry("tarotClothBlankCardBuffs", descObj.ObjSubType)
|
||||
if buffText then EID:appendToDescription(descObj, "#{{ColorSilver}}{{Collectible286}} " .. text .. " " .. buffText) end
|
||||
end
|
||||
@@ -618,7 +618,6 @@ if EID.isRepentance then
|
||||
|
||||
for i = 1,#EID.coopAllPlayers do
|
||||
local player = EID.coopAllPlayers[i]
|
||||
local playerID = EID:getPlayerID(player)
|
||||
local playerType = player:GetPlayerType()
|
||||
local pillModifierID = 0
|
||||
local goodAndBad = false
|
||||
|
||||
@@ -126,7 +126,7 @@ if EID.isRepentance then
|
||||
Isaac.ConsoleOutput("Load rep "..lang.." failed: "..tostring(err))
|
||||
end
|
||||
end
|
||||
local wasSuccessful, _ = pcall(require,"descriptions."..EID.GameVersion..".transformations")
|
||||
local _, _ = pcall(require,"descriptions."..EID.GameVersion..".transformations")
|
||||
require("features.eid_bagofcrafting")
|
||||
require("features.eid_tmtrainer")
|
||||
end
|
||||
@@ -912,6 +912,7 @@ function EID:renderIndicator(entity, playerNum)
|
||||
end
|
||||
|
||||
---@param entity Entity
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function EID:PositionLocalMode(entity)
|
||||
-- don't use Local Mode for descriptions without an entity (or dice floors)
|
||||
if (EID.Config["DisplayMode"] == "local" or alwaysUseLocalMode) and entity and entity.Variant ~= EffectVariant.DICE_FLOOR then
|
||||
@@ -1650,7 +1651,7 @@ if EID.isRepentance then
|
||||
end
|
||||
EID:AddCallback(ModCallbacks.MC_USE_ITEM, OnUseGenesis, CollectibleType.COLLECTIBLE_GENESIS)
|
||||
|
||||
local function OnUseLemegeton(_, _, player, _, _, _)
|
||||
local function OnUseLemegeton(_, _, _, _, _, _)
|
||||
EID.ShouldCheckWisp = true
|
||||
end
|
||||
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, OnUseLemegeton, CollectibleType.COLLECTIBLE_LEMEGETON)
|
||||
|
||||
Reference in new issue
Block a user