RimWorld

RimWorld

647 ratings
Dynamic Trade Interface
4
3
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5, 1.6
File Size
Posted
Updated
870.342 KB
Aug 15, 2023 @ 10:12am
Jun 12 @ 2:25pm
54 Change Notes ( view )

Subscribe to download
Dynamic Trade Interface

Description
A high-performance and customizable trade interface originally inspired by Trade UI Revised.
Written from scratch to not only avoid the biggest performance hits of the vanilla UI but to also allow for other mods to easily extend it with additional columns.

Can be safely added or removed at any time during a playthrough, since it doesn't add any game content.
Does not replace the vanilla trade window. Instead you can choose in the mod options whether to open this or vanilla one by default, the other one can be accessed by holding down ctrl as the window opens.

The changelog can be found under the Change Notes tab.

Features:
  • Performance friendly.
  • Resizable window.
  • Search and filter with RegEx
  • Selectable and resizable columns.
  • Click columns to sort. (Multiple by holding shift)
  • Buy or Sell max affordable using double arrow buttons.
  • Hide everything trader is unwilling to buy.
  • Open vanilla trade interface by holding ctrl as the window opens.
  • Option to only show trade buttons near the cursor for better performance.
  • Xenotype support.
  • Togglable and resizable summary section similar to TradeHelper.

Added columns:
  • Durability.
  • Price per weight.
  • Label variant of counter column.
  • Category.

Integrations & Compatibilities:

Limitations:
  • Due to how Rimworld's UI system works, controls will lose focus if any other control is made visible or invisible ahead of it. Generally to the left and up.
    This means that for example, putting the buttons to the left of the input counter boxes will cause them to unfocus when buttons change.
    There is now an option that can be enabled in the mod settings that attempts to compensate for this, by automatically refocusing the control whenever the focus is lost from changing interface. Often the escape button can be used to close windows that appear unreponsive.

Extendability (For modders):
XSD files are bundled with the mod describing how to define a TradeColumnDef.
Based on a number of method handlers, column behaviour can be easily referenced in C#.
Because it doesn't use any custom typings, it can all be defined without any need for assembly references or otherwise.

The following C# handlers can be defined:
  • static void PostOpen(IEnumerable<Tradeable> rows, Transactor transactor)
    Called twice after the window is opened initially, for Colony and Trader respectively. Useful for preparing cache.
  • static void PostClosed(IEnumerable<Tradeable> rows, Transactor transactor)
    Called twice after the window is closed, for Colony and Trader respectively. Useful for cleaning up cache.
  • static void Draw(ref Rect cell, Tradeable row, Transactor transactor, ref bool refresh)
    Called every frame for each row to draw column cells.
  • static Func<Tradeable, IComparable> OrderbyValue(Transactor transactor)
    Called once when the table is prepared to provide a sorting value selection function.

All source code can be found on Github[github.com]


Troubleshooting
Experiencing an issue?
  1. First check that it is actually caused by this mod; Either remove it temporarily, (can be added or removed any time!) or hold ctrl while trade opens to open the original vanilla trade window and check if isssue is also present there.
  2. If the issue is still there, then it isn't related to this mod and should be reported somewhere else.
  3. If you don't experience the issue with or in vanilla, then do provide a description of what you are trying to do, and what the problem you are experiencing is. The more details the better!
  4. If the issue causes an error in the log, then use Hugslib log publisher to provide the log in your report.


Previous versions[github.com]

Credits
Joseasoler for helping sanity checking code and ideas.
Ryan for the initial implementation of DragSelect and Gene Assistant support
Madman666 for the preview and icons.
Timmy for permission to implement features of TradeHelper
Spanish translation by Ferchu
Popular Discussions View All (3)
10
Mar 17, 2024 @ 11:48am
Error offering gifts to hostile settlement
Tom Jackal
4
Mar 14, 2024 @ 5:23pm
Error when trying to trade.
Tandy1000Synth
0
May 31 @ 9:37pm
Price unpredictability when paired with Everything has Quality Silver
Scarlet
218 Comments
Zeracronius  [author] 38 minutes ago 
@Bogatir
I do not understand what the incompatibility is, or the issue at hand.
The goodwill calculation uses the same vanilla function in the same way as the default trade window.
I assume that if RIMMSqol has a situation in which you are trading with yourself, then they have patched the vanilla trade window to support that?
Bogatir 9 hours ago 
found an compactability issue with RIMMSqol sitys. Thats what author of RIMMSqol said:
The mod tries to calculate the goodwill with the player faction from the trader faction. However they fail to safeguard that call against trade with the player faction itself.
ajejebrazorf Jun 14 @ 11:56am 
No worries, it happens. :)
Thanks for the super quick fix, it's working again now!
Zeracronius  [author] Jun 12 @ 2:30pm 
It should now be fixed, however steam does not like updating multiple times in a day, so you may need to resubscribe.

And as a reminder, all previous versions are available from the link in the description!
Zeracronius  [author] Jun 12 @ 2:15pm 
I have found the issue. I am very sorry about the inconvenience.
Turns out there was a previous typo in a file that caused it to load the 1.6 assembly in 1.5.
And i even double checked this multiple times. :steamfacepalm:

The fix should be up in a moment
ajejebrazorf Jun 12 @ 1:08pm 
With today fix it's not working anymore with 1.5 :( I'm getting the default trading window.
DubiousPhysics May 31 @ 10:40am 
Thanks so much for the quick fix! :D
Zeracronius  [author] May 30 @ 7:07am 
Thanks for letting me know, it is now fixed (oops!)
Funny difference between trading and gifting: the direction inverses.
DubiousPhysics May 29 @ 7:38am 
Very minor bug report here: in the gift interface, the "gift none" and "gift all" tooltips are swapped.

Thanks for the awesome mod!
Zeracronius  [author] May 25 @ 1:25pm 
Appreciate the heads up. I will see if i can figure out a solution.