It's terrible to check gem based on the prefab string suffix. which causes ancientfruit_gem was considered as gem.(Also we have dumbbell_gem but lucky it's not tradable)
AND JUST WATCH OUT SOME GUYS COULD ALREADY HAVE ANCIENTFRUIT GEM IN THEIR BATTERY SO PLEASE AVOID THE CRASH AFTER THIS FIXES.
-- moonrockcrater.lua local function ItemTradeTest(inst, item) if item == nil then return false elseif string.sub(item.prefab, -3) ~= "gem" then return false, "NOTGEM" elseif string.sub(item.prefab, -11, -4) == "precious" then return false, "WRONGGEM" end return true end -- winona_battery_high.lua local function ItemTradeTest(inst, item, doer) if item == nil then return false elseif item.prefab == "purebrilliance" then if doer and doer.components.skilltreeupdater and doer.components.skilltreeupdater:IsActivated("winona_lunar_2") then return true end return false, "NOGENERATORSKILL" elseif item.prefab == "alterguardianhatshard" then if doer and doer.components.skilltreeupdater and doer.components.skilltreeupdater:IsActivated("winona_lunar_1") then return true end return false, "NOGENERATORSKILL" elseif string.sub(item.prefab, -3) ~= "gem" then return false, "NOTGEM" elseif string.sub(item.prefab, -11, -4) == "precious" then return false, "WRONGGEM" end return true end -- pocketwatch.lua Actually it's do no affect cause only purplegem allowed local function Recall_ItemTradeTest(inst, item, giver) if item == nil then return false elseif string.sub(item.prefab, -3) ~= "gem" then return false, "NOTGEM" elseif item.prefab ~= "purplegem" then return false, "WRONGGEM" end return true end
I think tag check is a better way and already in crabking.
local function ShouldAcceptItem(inst, item) return item:HasTag("gem") and #inst.socketed < MAX_SOCKETS end
Steps to Reproduce
As Above
-
1
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now