I tried to implement something that was suggested a long time ago, and that I think makes sense: allow to check how much gold you have without going thru the classic trick of attempting to drop gold then retract.
I just update the itemInfoPanel when the mouse is over the GOLD button.
https://github.com/Interkarma/daggerfal ... nel-update
Almost works, except gold stacks have 0 value for some reason, reason being that their parent.value is also 0.
I'm not sure how and where to fix that without side-effects, any idea?
itemInfoPanel for gold
- pango
- Posts: 3358
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
itemInfoPanel for gold
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: itemInfoPanel for gold
I think a better approach may be to create a new method to update the info panel with the gold amount without requiring an item to be created and passed. Construct the message tokens and display gold and the value of letters of credit as separate lines. Then just hook up to the mouse enter.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- pango
- Posts: 3358
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: itemInfoPanel for gold
The nice thing about creating an item is that the weight was automatically computed too mmmh
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
-
- Posts: 102
- Joined: Tue Feb 12, 2019 12:55 am
Re: itemInfoPanel for gold
This looks fixable by adding a case statement to ItemHelper.GetItemInfo for ItemGroup.Currency.
[EDIT] Alternatively you could have the ItemBuilder.CreateGoldPieces correctly set the value as well as the stackCount. I'm not sure if this would have other side effects.
[EDIT2] If you set the stackCount to the number of gold pieces you need to set the value to 1 since value is per-item. This works for me.
[EDIT] Alternatively you could have the ItemBuilder.CreateGoldPieces correctly set the value as well as the stackCount. I'm not sure if this would have other side effects.
[EDIT2] If you set the stackCount to the number of gold pieces you need to set the value to 1 since value is per-item. This works for me.
-
- Posts: 102
- Joined: Tue Feb 12, 2019 12:55 am
Re: itemInfoPanel for gold
@pango, I submitted a PR against your branch. If you take it it will fix the display issue. I don't know the entire codebase well enough to say whether or not it will have other side effects but it actually seems more correct than it was before.
- pango
- Posts: 3358
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: itemInfoPanel for gold
Thanks for the help jimfcarroll!
I made a mess on GitHub though
It was displaying me a lot more stuff in your PR than the patch itself; It was probably just a re-merge of master (my branch was late by 3 commits vs master), but I panicked.
Long story short I had to recreate the useful commit. Hopefully I'll do better the next time
I made a mess on GitHub though
It was displaying me a lot more stuff in your PR than the patch itself; It was probably just a re-merge of master (my branch was late by 3 commits vs master), but I panicked.
Long story short I had to recreate the useful commit. Hopefully I'll do better the next time
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
- Nystul
- Posts: 1501
- Joined: Mon Mar 23, 2015 8:31 am
-
- Posts: 102
- Joined: Tue Feb 12, 2019 12:55 am
Re: itemInfoPanel for gold
No big deal. It was a 1 liner. Glad it helped.
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: itemInfoPanel for gold
That's pretty easy to do though, and a custom method would allow carried gold, wagon gold and LoC amount all to be displayed. No idea if that will look good, just wanted to suggest it to you as an option. Will leave to your judgement, I'm sure you'll submit a thorough job whichever way you go.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- pango
- Posts: 3358
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: itemInfoPanel for gold
You're too kind with me
They're many subsystem that I barely understand, and I don't have a working debugger so I don't get to see dynamic behaviors, I'm only using source code to understand what's going on.
It could very well be that a solution based on your idea is not that complex to implement, and does not resort to too much code duplication... But macros are still beyond my reach
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart