Refactored objectType & Charge display, to allow modders to alter Charge information
This commit is contained in:
1 parent
805d57540f
commit
4d60441150
4 files changed
+39
-23
No files matched your search
+20
@@ -392,6 +392,7 @@ function EID:getDescriptionObj(Type, Variant, SubType, entity, checkModifiers)
|
|||||||
description.ModName = tableEntry and tableEntry[4]
|
description.ModName = tableEntry and tableEntry[4]
|
||||||
description.Quality = EID:getObjectQuality(description)
|
description.Quality = EID:getObjectQuality(description)
|
||||||
description.Icon = EID:getObjectIcon(description)
|
description.Icon = EID:getObjectIcon(description)
|
||||||
|
EID:getObjectItemTypeAndCharge(description)
|
||||||
|
|
||||||
if checkModifiers ~= false then
|
if checkModifiers ~= false then
|
||||||
for _,modifier in ipairs(EID.DescModifiers) do
|
for _,modifier in ipairs(EID.DescModifiers) do
|
||||||
@@ -451,6 +452,25 @@ function EID:mergeDescriptionObjects(oldDescObj, newDescObj)
|
|||||||
end
|
end
|
||||||
return newDescObj
|
return newDescObj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function EID:getObjectItemTypeAndCharge(descObj)
|
||||||
|
if not (descObj.ObjType == 5 and descObj.ObjVariant == 100 and descObj.ObjSubType ~= nil) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local itemConfig = EID.itemConfig:GetCollectible(descObj.ObjSubType)
|
||||||
|
descObj.ItemType = itemConfig.Type or -1
|
||||||
|
|
||||||
|
if descObj.ItemType == ItemType.ITEM_ACTIVE then
|
||||||
|
descObj.ChargeType = itemConfig.ChargeType or 0
|
||||||
|
descObj.Charges = itemConfig.MaxCharges or 0
|
||||||
|
-- Special handling for dynamic charge items
|
||||||
|
if REPENTANCE and (descObj.ObjSubType == CollectibleType.COLLECTIBLE_BLANK_CARD or descObj.ObjSubType == CollectibleType.COLLECTIBLE_PLACEBO or
|
||||||
|
descObj.ObjSubType == CollectibleType.COLLECTIBLE_CLEAR_RUNE or descObj.ObjSubType == CollectibleType.COLLECTIBLE_D_INFINITY) then
|
||||||
|
descObj.ChargeType = ItemConfig.CHARGE_SPECIAL
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- returns the specified object table in the current language.
|
-- returns the specified object table in the current language.
|
||||||
-- falls back to english if it doesnt exist, unless specified otherwise
|
-- falls back to english if it doesnt exist, unless specified otherwise
|
||||||
function EID:getDescriptionEntry(objTable, objID, noFallback)
|
function EID:getDescriptionEntry(objTable, objID, noFallback)
|
||||||
|
|||||||
+5
-5
@@ -60,11 +60,11 @@ EID.TRANSFORMATION = {
|
|||||||
|
|
||||||
-- List of item Types
|
-- List of item Types
|
||||||
EID.ItemTypeAnm2Names = {
|
EID.ItemTypeAnm2Names = {
|
||||||
"null", -- 1
|
[ItemType.ITEM_NULL + 1] = "null",
|
||||||
"passive", -- 2
|
[ItemType.ITEM_PASSIVE + 1] = "passive",
|
||||||
"active", -- 3
|
[ItemType.ITEM_TRINKET + 1] = "active",
|
||||||
"familiar", -- 4
|
[ItemType.ITEM_ACTIVE + 1] = "familiar",
|
||||||
"trinket" -- 5
|
[ItemType.ITEM_FAMILIAR + 1] = "trinket"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- List of HUD elements, their position and usage
|
-- List of HUD elements, their position and usage
|
||||||
|
|||||||
@@ -203,6 +203,9 @@ local function onDebugRender(t)
|
|||||||
["ModName"] = "My Mod name",
|
["ModName"] = "My Mod name",
|
||||||
["Quality"] = 4,
|
["Quality"] = 4,
|
||||||
["Icon"] = EID.ObjectIcon["5.100.1"],
|
["Icon"] = EID.ObjectIcon["5.100.1"],
|
||||||
|
["ItemType"] = ItemType.ITEM_ACTIVE,
|
||||||
|
["ChargeType"] = ItemConfig.CHARGE_NORMAL,
|
||||||
|
["Charges"] = 3,
|
||||||
}
|
}
|
||||||
v:GetData()["EID_Description"] = descTable
|
v:GetData()["EID_Description"] = descTable
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -572,28 +572,21 @@ function EID:printDescription(desc, cachedID)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Display ItemType / Charge
|
--Display ItemType / Charge
|
||||||
local itemType = -1
|
if EID.Config["ShowItemType"] and (desc.ItemType == ItemType.ITEM_ACTIVE or desc.ItemType == ItemType.ITEM_FAMILIAR) then
|
||||||
if desc.ObjSubType ~= nil and desc.ObjType == 5 and desc.ObjVariant == 100 then
|
|
||||||
itemType = EID.itemConfig:GetCollectible(desc.ObjSubType).Type or -1
|
|
||||||
end
|
|
||||||
if EID.Config["ShowItemType"] and (itemType == 3 or itemType == 4) then
|
|
||||||
local offsetY = 2
|
local offsetY = 2
|
||||||
EID.IconSprite:Play(EID.ItemTypeAnm2Names[itemType])
|
local itemTypeAnm2 = EID.ItemTypeAnm2Names[desc.ItemType]
|
||||||
EID:renderIcon(EID.IconSprite, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale, nil, EID.ItemTypeAnm2Names[itemType], 0)
|
EID:renderIcon(EID.IconSprite, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale, nil, itemTypeAnm2 , 0)
|
||||||
if itemType == 3 then
|
if desc.ItemType == ItemType.ITEM_ACTIVE then
|
||||||
-- Display Charge
|
-- Display Charge
|
||||||
offsetX = offsetX + 1
|
offsetX = offsetX + 1
|
||||||
local curItemConfig = EID.itemConfig:GetCollectible(desc.ObjSubType)
|
local anim = "numbers"
|
||||||
local anim2 = "numbers"
|
local frameNum = desc.Charges or 0
|
||||||
local frame2 = curItemConfig.MaxCharges
|
if desc.ChargeType == (REPENTANCE and ItemConfig.CHARGE_TIMED or 1) then
|
||||||
if REPENTANCE and curItemConfig.ChargeType == ItemConfig.CHARGE_TIMED then
|
anim = "Misc"; frameNum = 6 -- Timer Icon
|
||||||
anim2 = "Misc"; frame2 = 6 -- Timer Icon
|
elseif desc.ChargeType == (REPENTANCE and ItemConfig.CHARGE_SPECIAL or 2) then
|
||||||
elseif REPENTANCE and (curItemConfig.ChargeType == ItemConfig.CHARGE_SPECIAL or desc.ObjSubType == CollectibleType.COLLECTIBLE_BLANK_CARD or desc.ObjSubType == CollectibleType.COLLECTIBLE_PLACEBO or
|
frameNum = 13 -- Question Mark Icon
|
||||||
desc.ObjSubType == CollectibleType.COLLECTIBLE_CLEAR_RUNE or desc.ObjSubType == CollectibleType.COLLECTIBLE_D_INFINITY) then
|
|
||||||
frame2 = 13 -- Question Mark Icon
|
|
||||||
end
|
end
|
||||||
EID.InlineIconSprite2:SetFrame(anim2, frame2)
|
EID:renderIcon(EID.InlineIconSprite2, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale, nil, anim, frameNum)
|
||||||
EID:renderIcon(EID.InlineIconSprite2, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale, nil, anim2, frame2)
|
|
||||||
end
|
end
|
||||||
offsetX = offsetX + 8
|
offsetX = offsetX + 8
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user