-
July 21st, 2024, 17:39 #31
This does not answer my question. It can't work with a combat group entry - which your code feeds it for NPC inventory drops. Do I have to butcher this and fix it myself?
Also, you did not answer the https://www.fantasygrounds.com/forum...l=1#post721245 bug? question. Am I going to have to fix this myself also?Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
July 21st, 2024, 18:30 #32
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,947
Basically, the ItemManager can't use startsWith to figure out where things are coming from, because NPCs and Vehicles need inventory (for some rulesets) and some will live on the party sheet, character sheet or other places. So, the ItemManager call to figure out the source needs to be different.
With the standard item transfer mechanics, it didn't need to be as specific, so it was working; but I can see the need for determining source a little better. I've pushed an update that should help.
Regards,
JPG
-
July 21st, 2024, 19:33 #33
ItemManager.getItemSourceType seems to be working again returning the source type regardless of node level, so that fixed it.
Currencies still are blocked (one example being combat group entry can't be parsed per previous mail in current new code checks) so I'll have to figure out how to override things to get that working again.Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
July 21st, 2024, 20:35 #34
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,947
What function is doing the currency transfer that is getting blocked?
Regards,
JPG
-
July 21st, 2024, 21:17 #35
Exactly what I said in here (CurrencyManager.addActorCurrency). But I've worked around that with the following fix to insure combattracker paths return a record type....
In onInit()...
Code:RecordDataManager.setRecordTypeOption("npc", "bInventory", true); RecordDataManager.setRecordTypeOption("npc", "bCurrency", true); RecordDataManager.setRecordTypeOption("vehicle", "bInventory", true); RecordDataManager.setRecordTypeOption("vehicle", "bCurrency", true); savegetRecordTypeFromListPath = RecordDataManager.getRecordTypeFromListPath; RecordDataManager.getRecordTypeFromListPath = getRecordTypeFromListPath;
Code:-- insure combattracker entries can return record type function getRecordTypeFromListPath(sListPath) local sRecordType = savegetRecordTypeFromListPath(sListPath); if sRecordType == "" and StringManager.startsWith(sListPath, "combattracker") then local nodeCT = DB.findNode(sListPath); if nodeCT then sRecordType, _ = DB.getValue(nodeCT, "link", "npc", ""); end end return sRecordType; end
Code:-- replaced ItemManager.getItemSourceType in order to support NPC inventory list function getItemSourceType(vNode) --Debug.console(User.getUsername() .. "(" .. tostring(Session.IsHost) .. ") -> manager_mapparcel:getItemSourceType called"); -- Call original code to see if it can resolve it - if not new npc inventory stuff local sReturn = savegetItemSourceType(vNode); if sReturn and sReturn ~= "" then if sReturn == "npc" or sReturn == "vehicle" then sReturn = "charsheet"; end end return sReturn; end
However, I'm still working through currency and encumbrance issues for npc/vehicle. Map Parcels is designed to allow map parcel treasureparcels to be moved back and forth between charsheet (npc/vehicle) inventories, other treasureparcels, and partysheet inventories where the data is actually moved (not copied though a button in map parcels form can be toggled to allow copying). Many years has done wonders for parcels - just need to recover where I was after this TEST update. Currently I'm down to finding out why (with above fixes) the currencies are not working going back into treasureparcels (no field data so ends up adding a blank field for each currency entry with correct value - still works when currency moved into charsheet/npc/vehicle/partysheet inventories) and figuring out why encumberance for npc/vehicle is not working (not sure when it stopped working as its busted in LIVE also - used to work). Also as party sheet has a link I'd want to support that also (to get full support of moving inventory/currency between any charsheet/npc/vehicle/treasureparcel/partysheet inventory).
Even with simple fixes like above it takes a lot of debug.console in different function in LIVE and TEST to figure out what has changed so may take a while before I solve the rest.Last edited by SilentRuin; July 21st, 2024 at 21:25.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
July 21st, 2024, 21:35 #36
Well the mystery of why my npc/vehicle charsheet inventory tabs no longer do encumberance is solved. At some point in some past FGU update I missed the functions
CharEncumbranceManager.enableCharCurrencyHandlers
CharEncumbranceManager.disableCharCurrencyHandlers
disappearing - which I overrode to support npc/vehicle inventory encumberances. Any idea what replaced them? This was not in this current TEST update FYI - they have been gone a while I suspect and never noticed.Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
July 21st, 2024, 22:31 #37
-
July 21st, 2024, 23:02 #38Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
July 21st, 2024, 23:06 #39
Bug in ItemManager.handleCurrencyTransfer.
You have to check for treasureparcels and partysheet before you jump off into something else. The if statement is out of order. It should look like this, otherwise it will never process the proper db.xml tags...
Code:-- insure combattracker entries can return record type function getRecordTypeFromListPath(sListPath) local sRecordType = savegetRecordTypeFromListPath(sListPath); if sRecordType == "" and StringManager.startsWith(sListPath, "combattracker") then local nodeCT = DB.findNode(sListPath); if nodeCT then sRecordType, _ = DB.getValue(nodeCT, "link", "npc", ""); end end return sRecordType; end function handleCurrencyTransfer(msgOOB) local nodeTargetRecord = DB.findNode(msgOOB.sTarget); if not nodeTargetRecord then return; end local nCurrency = tonumber(msgOOB.nCurrency) or 0; local sCurrency = msgOOB.sCurrency; Debug.console(nCurrency, sCurrency); local sTargetRecordType = ItemManager.getItemSourceType(nodeTargetRecord); Debug.console(sTargetRecordType); if sTargetRecordType == "treasureparcel" then local nodeTargetCoin = nil; local sCurrencyLower = sCurrency:lower(); for _,vParcelCoin in ipairs(DB.getChildList(nodeTargetRecord, "coinlist")) do Debug.console(DB.getValue(vParcelCoin, "description", ""):lower()); Debug.console(sCurrencyLower); if DB.getValue(vParcelCoin, "description", ""):lower() == sCurrencyLower then nodeTargetCoin = vParcelCoin; Debug.console(nodeTargetCoin); end end Debug.console(nodeTargetCoin); if not nodeTargetCoin then nodeTargetCoin = DB.createChild(DB.createChild(nodeTargetRecord, "coinlist")); DB.setValue(nodeTargetCoin, "description", "string", sCurrency); end DB.setValue(nodeTargetCoin, "amount", "number", nCurrency + DB.getValue(nodeTargetCoin, "amount", 0)); elseif sTargetRecordType == "partysheet" then local nodeCurrency = nil; local sCurrencyLower = sCurrency:lower(); for _,vPSCurrency in ipairs(DB.getChildList("partysheet.treasureparcelcoinlist")) do if DB.getValue(vPSCurrency, "description", ""):lower() == sCurrencyLower then nodeCurrency = vPSCurrency; break; end end if nodeCurrency then DB.setValue(nodeCurrency, "amount", "number", DB.getValue(nodeCurrency, "amount", 0) + nCurrency); else nodeCurrency = DB.createChild("partysheet.treasureparcelcoinlist"); DB.setValue(nodeCurrency, "description", "string", sCurrency); DB.setValue(nodeCurrency, "amount", "number", nCurrency); end elseif ItemManager.doesRecordTypeHaveCurrency(sTargetRecordType) then CurrencyManager.addActorCurrency(nodeTargetRecord, sCurrency, nCurrency); end end
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
July 22nd, 2024, 00:29 #40Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
Thread Information
Users Browsing this Thread
There are currently 8 users browsing this thread. (0 members and 8 guests)
Bookmarks