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.Quality = EID:getObjectQuality(description)
|
||||
description.Icon = EID:getObjectIcon(description)
|
||||
EID:getObjectItemTypeAndCharge(description)
|
||||
|
||||
if checkModifiers ~= false then
|
||||
for _,modifier in ipairs(EID.DescModifiers) do
|
||||
@@ -451,6 +452,25 @@ function EID:mergeDescriptionObjects(oldDescObj, newDescObj)
|
||||
end
|
||||
return newDescObj
|
||||
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.
|
||||
-- falls back to english if it doesnt exist, unless specified otherwise
|
||||
function EID:getDescriptionEntry(objTable, objID, noFallback)
|
||||
|
||||
+5
-5
@@ -60,11 +60,11 @@ EID.TRANSFORMATION = {
|
||||
|
||||
-- List of item Types
|
||||
EID.ItemTypeAnm2Names = {
|
||||
"null", -- 1
|
||||
"passive", -- 2
|
||||
"active", -- 3
|
||||
"familiar", -- 4
|
||||
"trinket" -- 5
|
||||
[ItemType.ITEM_NULL + 1] = "null",
|
||||
[ItemType.ITEM_PASSIVE + 1] = "passive",
|
||||
[ItemType.ITEM_TRINKET + 1] = "active",
|
||||
[ItemType.ITEM_ACTIVE + 1] = "familiar",
|
||||
[ItemType.ITEM_FAMILIAR + 1] = "trinket"
|
||||
}
|
||||
|
||||
-- List of HUD elements, their position and usage
|
||||
|
||||
@@ -203,6 +203,9 @@ local function onDebugRender(t)
|
||||
["ModName"] = "My Mod name",
|
||||
["Quality"] = 4,
|
||||
["Icon"] = EID.ObjectIcon["5.100.1"],
|
||||
["ItemType"] = ItemType.ITEM_ACTIVE,
|
||||
["ChargeType"] = ItemConfig.CHARGE_NORMAL,
|
||||
["Charges"] = 3,
|
||||
}
|
||||
v:GetData()["EID_Description"] = descTable
|
||||
end
|
||||
|
||||
@@ -572,28 +572,21 @@ function EID:printDescription(desc, cachedID)
|
||||
end
|
||||
|
||||
--Display ItemType / Charge
|
||||
local itemType = -1
|
||||
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
|
||||
if EID.Config["ShowItemType"] and (desc.ItemType == ItemType.ITEM_ACTIVE or desc.ItemType == ItemType.ITEM_FAMILIAR) then
|
||||
local offsetY = 2
|
||||
EID.IconSprite:Play(EID.ItemTypeAnm2Names[itemType])
|
||||
EID:renderIcon(EID.IconSprite, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale, nil, EID.ItemTypeAnm2Names[itemType], 0)
|
||||
if itemType == 3 then
|
||||
local itemTypeAnm2 = EID.ItemTypeAnm2Names[desc.ItemType]
|
||||
EID:renderIcon(EID.IconSprite, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale, nil, itemTypeAnm2 , 0)
|
||||
if desc.ItemType == ItemType.ITEM_ACTIVE then
|
||||
-- Display Charge
|
||||
offsetX = offsetX + 1
|
||||
local curItemConfig = EID.itemConfig:GetCollectible(desc.ObjSubType)
|
||||
local anim2 = "numbers"
|
||||
local frame2 = curItemConfig.MaxCharges
|
||||
if REPENTANCE and curItemConfig.ChargeType == ItemConfig.CHARGE_TIMED then
|
||||
anim2 = "Misc"; frame2 = 6 -- Timer Icon
|
||||
elseif REPENTANCE and (curItemConfig.ChargeType == ItemConfig.CHARGE_SPECIAL or desc.ObjSubType == CollectibleType.COLLECTIBLE_BLANK_CARD or desc.ObjSubType == CollectibleType.COLLECTIBLE_PLACEBO or
|
||||
desc.ObjSubType == CollectibleType.COLLECTIBLE_CLEAR_RUNE or desc.ObjSubType == CollectibleType.COLLECTIBLE_D_INFINITY) then
|
||||
frame2 = 13 -- Question Mark Icon
|
||||
local anim = "numbers"
|
||||
local frameNum = desc.Charges or 0
|
||||
if desc.ChargeType == (REPENTANCE and ItemConfig.CHARGE_TIMED or 1) then
|
||||
anim = "Misc"; frameNum = 6 -- Timer Icon
|
||||
elseif desc.ChargeType == (REPENTANCE and ItemConfig.CHARGE_SPECIAL or 2) then
|
||||
frameNum = 13 -- Question Mark Icon
|
||||
end
|
||||
EID.InlineIconSprite2:SetFrame(anim2, frame2)
|
||||
EID:renderIcon(EID.InlineIconSprite2, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale, nil, anim2, frame2)
|
||||
EID:renderIcon(EID.InlineIconSprite2, renderPos.X + offsetX * EID.Scale, renderPos.Y + offsetY * EID.Scale, nil, anim, frameNum)
|
||||
end
|
||||
offsetX = offsetX + 8
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user