Removing due to uncertainty regarding OGL v1.1
Printable View
Removing due to uncertainty regarding OGL v1.1
Since the first comment is mine, I will add the newest version I made here for easy access.
What's more in my version?
- Handles estimated item ranged prices such as: '101 - 500 gp'
Files:
1102 - My version, throws an error.
110 - Latest version patched by Cast.
So I did this:
https://media.discordapp.net/attachm...2518463/nn.png
Attachment 38504
I would post it but your license dosen't allow me. Let me know if you want it.
Wow, why didn't I notice this before 'wasting' my time building this into my inventory UI...
Honestly, I like your approach of posting it in chat much better.
Hi FeatherRin,
Thank you for testing it with 5e. I don't use 5e, so I didn't test it for that ruleset.
Yes. I can add it to the code if you are willing to share.Quote:
I would post it but your license dosen't allow me. Let me know if you want it.
My personal upgrades (Tested only in 5E)
-Removed fancy lines to fit the all command.
-Added "/charwealth all" catch, which outputs each pc's total item wealth and also the total party item wealth.
-Currently ignores all characters with 0 wealth even when solo checked, but you dont need it anyway. (I was too lazy to bother)
Released v1.1.0
Updated extension with two arguments. One calculates wealth for characters only on the party sheet. The other calculates wealth for all players, including those not on the party sheet.
Added support for 5E ruleset as well
Hey, its me again!
If you want player coins included as well, stick this in before nodeInventoryItems ;)
Happy bodging!Code:local nodeInventoryTreasure = DB.getChildren(nodeChar, "coins");
if nodeInventoryTreasure then -- If the inventory list is not nil --
for k, nodeCoin in pairs(nodeInventoryTreasure) do -- For every item in the inventory list --
local sCoinName = DB.getValue(nodeCoin, "name", ""):upper();
local sCoinAm = DB.getValue(nodeCoin, "amount", "");
if sCoinName == "GP" then
nRunningTotal = nRunningTotal + sCoinAm;
elseif sCoinName == "PP" then
nRunningTotal = nRunningTotal + sCoinAm * 10;
elseif sCoinName == "SP" then
nRunningTotal = nRunningTotal + sCoinAm * 0.1;
elseif sCoinName == "CP" then
nRunningTotal = nRunningTotal + sCoinAm * 0.01;
elseif sCoinName .. " " == " " then -- Don't spam for empty cells. --
--Nothing
else -- Currency is defined, but is not a standard currency --
sChatMessage = "" .. sCoinName .. ": Excluded. Non-standard currency used";
printChatMessage(sChatMessage);
end
end
end
ps: might as well credit me in the xml :p
pps: elifs break automatically, you dont need to break them.
ppps: i think everything is core func anyway, just set it to any and let people try it out without guarantee
pppps: no one uses electrum, dont even bother
...also here's a "concat" to solve the '-' problems.
It grabs the second (highest) number of the two with minimal effort and no (extra) memory usage. At higher levels it's inaccurate, but at that point I doubt people care.
'101 - 500 gp' => '500 gp'
'10,000 - 50,000 gp' => '50,000 gp'
Code:if string.match(sItemCost,"-") then
sItemCost = string.sub((string.match(string.reverse(sItemCost), "(.+)%-")):reverse(), 2);
end
It has to go right before this part, otherwise it will mess up the conversion.
Code:local aCostData = StringManager.split(sItemCost, " ", true);
Here's the file for those who can't wait for WatBot2ndBrkfst and can't do it for themselves.
Added:
-Counts player money (coins/treasure) towards total.
-Support for estmated range prices such as '101 - 500 gp', uses higher number.
Mind if I steal this? I've just been skipping those items and 'complaining' about it in chat.
Attachment 40354 What am I doing wrong? This is what I get when I attempt to /charwealth a character or party.
is it my or Brkfast's version?
I suspect you have a problem with your currencies not being properly set up, but this is not enough info to go deeper :)
Attachment 40356
Here is a shot of the character and extensions running
Well, you seem to be running my version (1011).
For me it seems to run fine, but you can try running the original 1.0.1 instead.
Tell me if that works. If it does, its my fault and I will try to find out whats wrong with it.
Ah, yes, I found it.
The '-' concat was just thrown together and is garbage. If an item price is not set up properly it throws and error.
Use 1.0.1 or fix the item prices of items manually for now.
'x - y gp' is the only way it accepts range prices.
Thank you for your answers. I will get 1.01, my 'programming' experience ended with Apple IIe.
btw, does pathfiner use special item prices? like a-b gp or stuff?
Please write down what dosent conform to the current script in your inventory.
If its a range, it has took like this:
https://media.discordapp.net/attachm...26/unknown.png
Try checking prices of magical items in player inventory.
Some costs are broken by default.
If you find anything thats not a standard price eg (50,000 gp) or (100 - 1,000 gp) on the item prices, you can edit it manually there. Delete the costs lines, or change them to what you want.
This is a small patch that fixes a crash related to my garbage concat.
Now it should ignore '-' containing strings that are too short to handle.
(anything too short is meaningless but was unhandled before)
The latest update is throwing an error when this extension loads. 4.1.12
The extension itself seems to be working it just generates this error on start.
Script execution error:[string "scripts/character_wealth.lua"]:12: attempt to call field 'registerLaunchMessage' (a nil value)
Also Getting Cel's error, FeatherRin.
Cel,
I went ahead and fixed this by changing the extension to a .zip file, opening up the only file in the scripts folder in notepad, finding line 12 and removing:
ChatManager.registerLaunchMessage(msg);
Save the file, pop it back into the zip file, change it back to a .ext file, and it should run without an error.
Make sure you make a duplicate copy of the extension just in case.
Yup that did the trick, figured it would be something simple like that.
Thanks.
I'm sure there's a more elegant way to actually use the announcements tag, but I'm not much of a programmer. See attached, Rin.
Thanks!
-Cast
There's also an xml tag you can put in extension.xml such as:
This will auto-post "Character Wealth Extension v1.1.0" in the chat when you load the extension and will make it a link to this thread.Code:<announcement text="https://www.fantasygrounds.com/forums/showthread.php?58418-PFRPG-Character-Wealth-Extension\rCharacter Wealth Extension v1.1.0" font="emotefont" />
Thanks, BMOS!
I'm only a front-end developer on TV, so without spending some time studying the reference, removing it was the easiest way I knew.
This looks promising.
Any chance it could default to gp if there is only a number and no gp? IOW if the item says 4000 instead of 4000 gp?
also, could we get this into forge?
User error - never mind