PDA

View Full Version : Dropping an item from a parcel with more than 1 count into charsheet - BUGGED



SilentRuin
March 1st, 2021, 01:14
I spent an enormous amount of time today trying to figure out why my extension had the charsheet inventory item count drop back to 1 anytime a parcel was used to drop the item with count > 1 in it and a player was attached to the host for that sheet.

Only to find its FGU doing it RAW with no extensions.

Here is how to duplicate it.
FGU 5E ruleset.
1) Create a parcel.
2) Put a unique item in that the charsheet does not have in its inventory.
3) Make that item count in the parcel > 1.
4) Connect a player to your host.
5) Have player pick a character - Bring up a character sheet - open inventory tab.
6) Have host open that same character sheet to its inventory tab.
7) Open parcel on host and drag your unique item with > 1 count into the charsheet inventory.
8) Watch the count on your host immediately flash back a count of 1.
9) Watch the count on your player inventory show the count you actually just put in there.
10) See the count in the DB actually reflect the hosts version of count of 1 as the true value even though player still shows the count you moved over originally until you change that count (then they get in synch correctly).

Bugged. Please fix. I need this to work as it does in host without a player attached - do the same operations without a player attached and you'll see how it should work.

kevininrussia
March 1st, 2021, 01:23
Same issue in 4E.

LordEntrails
March 1st, 2021, 01:43
This has always been the behavior of FG. Whenever an items is dragged and dropped onto a charactersheet, it always just drops a quantity of one. I've never tried doing it from a parcel, but you can see this behavior when dragging from the party inventory. FG will add one of those items, unique or not, and decrement the party inventory by one.

There are possibilities for other behavior here, like if the source has a qty >1 to have a pop up or other manner to transfer more than 1, but as far as I know, current behavior is intentional.

SilentRuin
March 1st, 2021, 02:06
This has always been the behavior of FG. Whenever an items is dragged and dropped onto a charactersheet, it always just drops a quantity of one. I've never tried doing it from a parcel, but you can see this behavior when dragging from the party inventory. FG will add one of those items, unique or not, and decrement the party inventory by one.

There are possibilities for other behavior here, like if the source has a qty >1 to have a pop up or other manner to transfer more than 1, but as far as I know, current behavior is intentional.

(Sigh) Read more than the first line. This is nothing of what you think it is. I understand how parcels work - including what you thought this was about - which it is not. Parcels transfer whole entries they are not charsheets.

SilentRuin
March 1st, 2021, 05:50
You know what? I'm just going to fix my own version of it and leave FGU to fix theirs whenever.

If they are interested the bug to make the mysterious 1 setting not matter is to make parcel to charsheet to behave like the other things and move it out of the if statement is in to the one below it....



elseif (sSourceRecordType == "partysheet" and sTargetRecordType == "charsheet") or
(sSourceRecordType == "treasureparcel" and sTargetRecordType == "charsheet") or
(sSourceRecordType == "charsheet" and sTargetRecordType == "treasureparcel") or
(sSourceRecordType == "charsheet" and sTargetRecordType == "charsheet") or
(sSourceRecordType == "charsheet" and sTargetRecordType == "partysheet") then
if bTransferAll then
bCountN = true;
end

Zacchaeus
March 1st, 2021, 10:19
Yes, I can reproduce this.

If I create a parcel with three potions of healing and drag the parcel and drop it on inventory then on the DM screen only 1 item is shown whereas in the client view it shows three. If I then drag in another single potion into the inventory then both client and host show 4 as the total - so the character sheet is not showing the correct count on the DM host but as you say the database value must be 3. It doesn't matter either whether I share the parcel first and have the client drag/drop the parcel into the inventory - the host still only shows 1 item. Additionally if I simply drag the item from the parcel into the inventory then I again get 1 on the DM side and three in the client. And finally if I distribute the parcel via the Party sheet then once again the DM gets 1 and the client three.

So, yes; currently adding multiples of an item to the inventory at once is bugged on the DM side.

Kelrugem
March 1st, 2021, 14:34
I don't think that it is intended to do any type of such distributions from a parcel directly; normally such things (with higher amount of 1) are done via the party sheet and shift-drag :)

(and now I was writing it I see that Moon Wizard already wrote you that on Discord :D)

EDIT: Of course may be nice to be able to do that via a parcel, too, I think, though I personally use the party sheet all the time

SilentRuin
March 1st, 2021, 14:39
Even my above fix is only a partial fix for the issue. I’ll try to fix my stuff with a better patch - single parcel to charsheet is still whacked if you try to use shift with it if a player is attached. I won’t take any bets if I do kludge it that it won’t all fall apart after they truly fix it but per my usual coding luck - rock... meet hard place.

SilentRuin
March 1st, 2021, 14:41
I don't think that it is intended to do any type of such distributions from a parcel directly; normally such things (with higher amount of 1) are done via the party sheet and shift-drag :)

(and now I was writing it I see that Moon Wizard already wrote you that on Discord :D)

EDIT: Of course may be nice to be able to do that via a parcel, too, I think, though I personally use the party sheet all the time
You to don’t understand. Hence why I’ll fix it myself.

Kelrugem
March 1st, 2021, 14:48
You to don’t understand. Hence why I’ll fix it myself.

I do understand since I can reproduce it :) Moreover, for example when you share the parcel with the player, then I can also reproduce it on the client by drag&drop :) Hence, I am very aware of that (is already the case for a longer time as far as I remember). Simply saying that it is not (yet) intended to distribute items directly from parcels which is why you see such things; not saying that it may or may not be adjusted :) So, no reason to be blunt

SilentRuin
March 1st, 2021, 15:05
I do understand since I can reproduce it :) Moreover, for example when you share the parcel with the player, then I can also reproduce it on the client by drag&drop :) Hence, I am very aware of that (is already the case for a longer time as far as I remember). Simply saying that it is not (yet) intended to distribute items directly from parcels which is why you see such things; not saying that it may or may not be adjusted :) So, no reason to be blunt

Sadly I don't have the option of having my extension's user suffer corrupted or loss of data. FGU RAW can leave it if they like - I'm going to at least make the attempt to fix it even with that bizarre overwrite of the data in "count" only when a player is attached which I suspect is being done by engine code since I can't find it anywhere else. Either way - I'm take the shot of at least trying to fix it.

Oh and your "partysheet" does the same thing with the same bug.

Kelrugem
March 1st, 2021, 15:13
Sadly I don't have the option of having my extension's user suffer corrupted or loss of data. FGU RAW can leave it if they like - I'm going to at least make the attempt to fix it even with that bizarre overwrite of the data in "count" only when a player is attached which I suspect is being done by engine code since I can't find it anywhere else. Either way - I'm take the shot of at least trying to fix it.

Oh and your "partysheet" does the same thing with the same bug.

Yeah, I see why you want to fix that because of the map parcel extension :) (I still need to try out your extension since it sounds nice)

About the party sheet: I cannot reproduce the bug there, make sure you did not have your extension loaded because maybe the party sheet behaviour may get overwritten; for me the party sheet works, just tested (and make sure you press shift while dragging, otherwise it will be just a count of 1)

Kelrugem
March 1st, 2021, 15:22
Okay, correction: Indeed, the party sheet won't work properly now, too :) Yeah, there it is certainly a bug

(I think when I quickly tested that, that I accidentally looked at the client :D One really needs to be careful where to look)

SilentRuin
March 1st, 2021, 15:29
Okay, correction: Indeed, the party sheet won't work properly now, too :) Yeah, there it is certainly a bug

(I think when I quickly tested that, that I accidentally looked at the client :D One really needs to be careful where to look)

Yeah, pretty much anything (even parcels in my fixed version) that drops something in charsheet will only not get stomped if no player is attached to host. That logic I can't find that decides to arbitrarily stomp it (only if you have no previous item of the same type in charsheet) is annoying in the extreme.

I'm going to experiment around and try an elaborate double call of the addItemToList - sadly its even worse than it appears because double calling in the same OOB still gets it stomped in the end - because leaving that routine the node has the correct count. I'll try to double it with another OOB call in hopes I can come in after whatever it is decides to stomp it. Likely have to say - is the item in th e target and is target charsheet? If in the target - just proceed normally. If not in the target - and transfer all is in effect - then call once with transferall set to false (to get it in sheet with count 1) then call again with transferall set to true. I actually tried that directly - but of course the stomping mystery code (only when player attached) managed to still stomp it (plus there was no append logic to apply because the count was correct at this level). Gist is - PAIN.

mattekure
March 1st, 2021, 15:41
FWIW I ran into this same bug when I was creating my Shops extension, and ended up writing my own workaround too.

kevininrussia
March 1st, 2021, 16:47
I want to give a shout out to all you extension and mod developers. You all are making FGU a better product and I appreciate all the work you all put into this. Thank you!

SilentRuin
March 1st, 2021, 16:51
FWIW I ran into this same bug when I was creating my Shops extension, and ended up writing my own workaround too.

Hopefully you just grabbed the raw data and did the transfer yourself - I'm not so lucky that I can get away with that :(

SilentRuin
March 1st, 2021, 19:24
All right I fixed my stuff. Same fixes could be used for FGU but meh - tired of arguing. I'll post in general what I did.

CoreRPG\scripts\manager_item.lua
function addItemToList
Added in this near top


if bTransferAll then
local bFoundItem = false;
-- due to bug with player connected to host stomping count to 1 no matter how many put into new inventory record cannot transfer all without shift
if sTargetRecordType == "charsheet" then
for _,vNode in pairs(DB.getChildren(nodeList, "")) do
if ItemManager.compareFields(nodeSource, vNode, true) then
bFoundItem = true;
break;
end
end
-- We only need to fake this if the item does not already exist.
-- has the effect that when you transfer items to charsheet you have to do it potentially twice to get them all in.
if not bFoundItem then
bTransferAll = false;
end
end
end


Also move if statement as shown here further down:


elseif (sSourceRecordType == "partysheet" and sTargetRecordType == "charsheet") or
(sSourceRecordType == "treasureparcel" and sTargetRecordType == "charsheet") or
(sSourceRecordType == "charsheet" and sTargetRecordType == "treasureparcel") or
(sSourceRecordType == "charsheet" and sTargetRecordType == "charsheet") or
(sSourceRecordType == "charsheet" and sTargetRecordType == "partysheet") then
if bTransferAll then
bCountN = true;
end



Also for where I do mass transfers for links I did the same fake logic at top.

Prevents corruption but will require you to transfer things from partysheet,parcel sheet, charsheet to a charsheet twice in some cases.

STORY ENDS?

Moon Wizard
March 4th, 2021, 00:05
The way that it was built was that treasure parcels were not a "box" for players to use; but a "group" for GMs to use. In that design, it's not expected that you would drag back/forth between a PC and a parcel; and when you did, it was expected that you just wanted to make a copy, not transfer at all.

The code that you highlighted in red is already surrounded by code that has been modified from original CoreRPG ItemManager; as the current code doesn't match what you posted.

Given that, I would still be interested in seeing what you came up with to handle the "default" = 1 issue from player's having character open while transferring a stack, instead of 1 at a time. I have to think on whether it makes sense to treat a parcel like a "box" in a general sense.

Regards,
JPG

SilentRuin
March 4th, 2021, 00:54
The way that it was built was that treasure parcels were not a "box" for players to use; but a "group" for GMs to use. In that design, it's not expected that you would drag back/forth between a PC and a parcel; and when you did, it was expected that you just wanted to make a copy, not transfer at all.

The code that you highlighted in red is already surrounded by code that has been modified from original CoreRPG ItemManager; as the current code doesn't match what you posted.

Given that, I would still be interested in seeing what you came up with to handle the "default" = 1 issue from player's having character open while transferring a stack, instead of 1 at a time. I have to think on whether it makes sense to treat a parcel like a "box" in a general sense.

Regards,
JPG

Sure just DM me in discord and I can create a discord server and share my screen and use words as its easier to show and tell then text back and forth. It's not that hard. And yes its different by maybe one extra line because I do full transfer between charsheet/partysheet/parcels in player or host (between any of them) in Map Parcel. Just let me know and I can show you. Also I tend to only do the transfer when I detect is part of an Image or the delete on empty flag is set - that way it does not change behavior on RAW FGU read only type of parcels. If I remember right. Basically, all three work the same when doing a copy or transfer to the charsheet (which will stomp it dead with a 1 if has more than one and SHIFT or link is used to copy it in - and a player is attached). The code that does that is included above. Pretty simple trick really.