Cicatrization shown in health panel
This commit is contained in:
@@ -10,11 +10,14 @@ local CachedDataHandler = {}
|
||||
---@param username string
|
||||
function CachedDataHandler.Reset(username)
|
||||
CachedDataHandler.amputatedLimbs[username] = {}
|
||||
CachedDataHandler.indexedAmputatedLimbs[username] = {}
|
||||
|
||||
CachedDataHandler.highestAmputatedLimbs[username] = {}
|
||||
end
|
||||
|
||||
--* Amputated Limbs caching *--
|
||||
CachedDataHandler.amputatedLimbs = {}
|
||||
CachedDataHandler.indexedAmputatedLimbs = {}
|
||||
-- TODO Add an indexable table too!
|
||||
|
||||
---Calculate the currently amputated limbs for a certain player
|
||||
@@ -35,7 +38,12 @@ end
|
||||
---@param limbName string
|
||||
function CachedDataHandler.AddAmputatedLimb(username, limbName)
|
||||
TOC_DEBUG.print("added " .. limbName .. " to known amputated limbs for " .. username)
|
||||
|
||||
-- Add it to the generic list
|
||||
table.insert(CachedDataHandler.amputatedLimbs[username], limbName)
|
||||
|
||||
-- Add it to the indexable list
|
||||
CachedDataHandler.indexedAmputatedLimbs[username][limbName] = limbName
|
||||
end
|
||||
|
||||
---Returns a table containing the cached amputated limbs
|
||||
@@ -45,6 +53,12 @@ function CachedDataHandler.GetAmputatedLimbs(username)
|
||||
return CachedDataHandler.amputatedLimbs[username]
|
||||
end
|
||||
|
||||
---@param username string
|
||||
---@return table
|
||||
function CachedDataHandler.GetIndexedAmputatedLimbs(username)
|
||||
return CachedDataHandler.indexedAmputatedLimbs[username]
|
||||
end
|
||||
|
||||
--* Highest amputated limb per side caching *--
|
||||
CachedDataHandler.highestAmputatedLimbs = {}
|
||||
|
||||
|
||||
@@ -11,17 +11,15 @@ local Main = {}
|
||||
function Main.SetupTraits()
|
||||
-- Perks.Left_Hand is defined in perks.txt
|
||||
|
||||
local traitsTable = {}
|
||||
local trait1 = TraitFactory.addTrait("Amputee_Hand", getText("UI_trait_Amputee_Hand"), -8, getText("UI_trait_Amputee_Hand_desc"), false, false)
|
||||
traitsTable[1] = trait1
|
||||
|
||||
local trait2 = TraitFactory.addTrait("Amputee_LowerArm", getText("UI_trait_Amputee_LowerArm"), -10, getText("UI_trait_Amputee_LowerArm_desc"), false, false)
|
||||
traitsTable[2] = trait2
|
||||
|
||||
local trait3 = TraitFactory.addTrait("Amputee_UpperArm", getText("UI_trait_Amputee_UpperArm"), -20, getText("UI_trait_Amputee_UpperArm_desc"), false, false)
|
||||
traitsTable[2] = trait3
|
||||
local traitsTable = {
|
||||
[1] = TraitFactory.addTrait("Amputee_Hand", getText("UI_trait_Amputee_Hand"), -8, getText("UI_trait_Amputee_Hand_desc"), false, false),
|
||||
[2] = TraitFactory.addTrait("Amputee_LowerArm", getText("UI_trait_Amputee_LowerArm"), -10, getText("UI_trait_Amputee_LowerArm_desc"), false, false),
|
||||
[3] = TraitFactory.addTrait("Amputee_UpperArm", getText("UI_trait_Amputee_UpperArm"), -20, getText("UI_trait_Amputee_UpperArm_desc"), false, false)
|
||||
}
|
||||
|
||||
for i=1, #traitsTable do
|
||||
|
||||
---@type Trait
|
||||
local t = traitsTable[i]
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
t:addXPBoost(Perks.Left_Hand, 4)
|
||||
|
||||
@@ -10,7 +10,7 @@ local CutLimbHandler = require("TOC/UI/CutLimbInteractions")
|
||||
-- We also manage the drag'n drop of items on the body to let the players use the saw this way too
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
|
||||
ISHealthBodyPartPanel = ISBodyPartPanel:derive("ISHealthBodyPartPanel")
|
||||
--ISHealthBodyPartPanel = ISBodyPartPanel:derive("ISHealthBodyPartPanel")
|
||||
|
||||
--* Handling drag n drop of the saw *--
|
||||
|
||||
@@ -163,4 +163,35 @@ function ISMedicalCheckAction:perform()
|
||||
-- We need to recalculate them here before we can create the highest amputations point
|
||||
CachedDataHandler.CalculateAmputatedLimbs(username)
|
||||
og_ISMedicalCheckAction_perform(self)
|
||||
end
|
||||
|
||||
local og_ISHealthBodyPartListBox_doDrawItem = ISHealthBodyPartListBox.doDrawItem
|
||||
function ISHealthBodyPartListBox:doDrawItem(y, item, alt)
|
||||
y = og_ISHealthBodyPartListBox_doDrawItem(self, y, item, alt)
|
||||
y = y - 5
|
||||
local x = 15
|
||||
local fontHgt = getTextManager():getFontHeight(UIFont.Small)
|
||||
|
||||
-- TODO Get username of the correct player
|
||||
local username = getPlayer():getUsername()
|
||||
--local amputatedLimbs = CachedDataHandler.GetIndexedAmputatedLimbs(username)
|
||||
|
||||
---@type BodyPart
|
||||
local bodyPart = item.item.bodyPart
|
||||
|
||||
local bodyPartTypeStr = BodyPartType.ToString(bodyPart:getType())
|
||||
local limbName = StaticData.LIMBS_IND_STR[bodyPartTypeStr]
|
||||
if limbName then
|
||||
local modDataHandler = ModDataHandler.GetInstance(username)
|
||||
if modDataHandler:getIsCut(limbName) and modDataHandler:getIsVisible(limbName) then
|
||||
local cicaTime = modDataHandler:getCicatrizationTime(limbName)
|
||||
self:drawText("- " .. "Cicatrization " .. tostring(cicaTime), x, y, 0.89, 0.28, 0.28, 1, UIFont.Small)
|
||||
y = y + fontHgt;
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
y = y + 5
|
||||
return y
|
||||
end
|
||||
Reference in New Issue
Block a user