fix: 42.12 new bodyloc
This commit is contained in:
@@ -4,7 +4,7 @@ local OverridenMethodsArchive = require("TOC/OverridenMethodsArchive")
|
||||
local og_ISClothingExtraAction_isValid = OverridenMethodsArchive.Get("ISClothingExtraAction_isValid")
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function ISClothingExtraAction:isValid()
|
||||
TOC_DEBUG.print("Inside ISClothingExtraAction:isValid 42")
|
||||
TOC_DEBUG.print(OverridenMethodsArchive.Get("ISClothingExtraAction_isValid"))
|
||||
-- TOC_DEBUG.print("Inside ISClothingExtraAction:isValid 42")
|
||||
-- TOC_DEBUG.print(OverridenMethodsArchive.Get("ISClothingExtraAction_isValid"))
|
||||
return LimitActionsController.WrapClothingAction(self, og_ISClothingExtraAction_isValid, instanceItem(self.extra))
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
require("TOC/Debug")
|
||||
require("NPCs/BodyLocations")
|
||||
local StaticData = require("TOC/StaticData")
|
||||
|
||||
local BodyLocationsAPI = {}
|
||||
local function customGetVal(obj, int) return getClassFieldVal(obj, getClassField(obj, int)) end
|
||||
@@ -8,6 +9,8 @@ local group = BodyLocations.getGroup("Human")
|
||||
---@type ArrayList
|
||||
local list = customGetVal(group, 1)
|
||||
|
||||
-- TODO Not sure if this method actually works as intende with b42, but for our use case it's fine...
|
||||
|
||||
---@param toRelocateOrCreate string
|
||||
---@param locationElement string
|
||||
---@param afterBoolean boolean
|
||||
@@ -19,7 +22,15 @@ function BodyLocationsAPI.MoveOrCreateBeforeOrAfter(toRelocateOrCreate, location
|
||||
if itemToMoveTo ~= nil then
|
||||
-- Check type of arg 1 == string - if not, error out.
|
||||
if type(toRelocateOrCreate) ~= "string" then error("Argument 1 is not of type string. Please re-check!", 2) end
|
||||
local curItem = group:getOrCreateLocation(toRelocateOrCreate) -- get current item - or create
|
||||
|
||||
local curItem
|
||||
if StaticData.COMPAT_42 then
|
||||
curItem = BodyLocation.new(group, toRelocateOrCreate) -- create new item
|
||||
group:getAllLocations():add(curItem) -- add to the list
|
||||
else
|
||||
curItem = group:getOrCreateLocation(toRelocateOrCreate) -- get current item - or create
|
||||
|
||||
end
|
||||
list:remove(curItem) -- remove from the list
|
||||
local index = group:indexOf(locationElement) -- get current index after removal of the location to move to
|
||||
if afterBoolean then index = index + 1 end -- if we want it after it, we increase the index to move to by one
|
||||
@@ -32,19 +43,18 @@ function BodyLocationsAPI.MoveOrCreateBeforeOrAfter(toRelocateOrCreate, location
|
||||
end
|
||||
end
|
||||
|
||||
function TestBodyLocations()
|
||||
local group = BodyLocations.getGroup("Human")
|
||||
local x = group:getAllLocations()
|
||||
-- function TestBodyLocations()
|
||||
-- local group = BodyLocations.getGroup("Human")
|
||||
-- local x = group:getAllLocations()
|
||||
|
||||
for i=0, x:size() -1 do
|
||||
-- for i=0, x:size() -1 do
|
||||
|
||||
---@type BodyLocation
|
||||
local bl = x:get(i)
|
||||
-- ---@type BodyLocation
|
||||
-- local bl = x:get(i)
|
||||
|
||||
print(bl:getId())
|
||||
end
|
||||
|
||||
end
|
||||
-- print(bl:getId())
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- MultiItem causes a ton of issues... fucking hell
|
||||
|
||||
|
||||
Reference in New Issue
Block a user