Fallout 76

File information

Last updated

Original upload

Created by

SureshotM6

Uploaded by

SureshotM6

Virus scan

Safe to use

Tags for this mod

About this mod

Displays high precision stack weights in brackets next to Weight in all trading interfaces.

Permissions and credits
Changelogs
Displays the total weight of stacks of items in stash boxes, vendors, workbenches, vending machines, containers, player trading, etc. (anywhere the item trading interface is used) in brackets next to the per-item weight.  This will display weights with the same precision as per-item weight, including showing weights <1.  The redundant "Stack Weight" box added in FO76 patch 1.5.1.26 (Jan 26 2021) will be removed.  

If you also want stack weights in this format in your Pip-Boy, install Better Inventory as well.

Note that this mod will very likely break when the game is updated, same as any other mod that modifies swf files.

Compatibility:
This mod is not compatible with any other mod that modifies securetrade.swf.  Notably, it has been pointed out that Save Everything and ItemExtractorMod are incompatible.

To install, either:

Use the Fallout 76 Quick Configuration tool and install as a "Separate *.ba2 file"

-or-

Edit Project76Custom.ini / Fallout76Custom.ini (in %HOMEPATH%\Documents\My Games\Fallout 76\) to append to sResourceArchive2List:

[Archive]
sResourceArchive2List = StashStackWeights.ba2

and place StashStackWeights.ba2 in your Fallout 76 game Data folder (%PROGRAMFILES%\ModifiableWindowsApps\Fallout 76\Data\ or %PROGRAMFILES%\Bethesda.net Launcher\games\Fallout76\Data\).

Future Plans
I have prototyped adding total tab weights.  Unfortunately there are a few issues which currently make this unreliable and will need further investigation:
  • Weights of items in the stash have weight reduction perks already applied so the tab totals would be wrong.  This is especially visible in the "Inventory" tab showing all items, where the total tab weight for the stash side may be hundreds of pounds lighter.  Basically, the item weight displayed on the stash side shows you how much the item would weigh if it were transferred to your player inventory.  That is the way that Bethesda implemented this and a frequent complaint on forums.
  • Tab weight totals in player inventory don't sum up to the player's current weight (but they do match those computed by Better Inventory).  I believe part of this is due to quest items not technically contrIbuting to carry weight, but even after excluding those I have observed a difference of more than 5%. I suspect this is due to the lower weight precision available to this interface and accumulation of these small errors (0.01 for example) over thousands of items.

Possibly adding "true weight" (actual weight without perks applied) to items in the stash box side.  This would be required to implement a correct total tab weight for the stash side of the interface.  This information unfortunately not part of the inventory object JSON already.  Perhaps there is an API to query it, or perhaps I could embed a database of true items weights into the mod (but that may be large).

Development Info (v1.3)
If anyone wants to build upon this mod (with attribution) or is just interested in how this works, the following locations were modified. Follow the basic steps from previous releases to extract and repackage.  Since a "Stack Weight" card is officially supported now, the changes are much different than before.  Also note that editing AS3 directly in JPEXS is not safe and will cause breakages; therefore you must edit the P-Code directly.

Edit redrawUIComponent in ItemCard.as
  • There is a new check in here for the "$wt" card and an item count of > 1, so that no longer needs to be added.
  • Move the call to PopulateEntry for the "$wt" card above this check
  • Remove the creation of a new ItemCard_Standard for "$StackWeight"
  • Call populateStackWeight on the "$wt" card and InfoObj instead of on the removed "$StackWeight" card

Edit populateStackWeight in ItemCard_Entry.as
  • This is almost a complete rewrite, except the calculation of stackWeight and the call to GlobalFunc.SetText can be reused
  • Compute the needed precision (number of decimal places) of the stack weight based on the number of decimal places in the current weight string.
  • Compute the stack weight string with toFixed(precision)
  • Trim trailing zeros off both strings with GlobalFunc.TrimZeros (saves some space)
  • Construct the new string value for the "$wt" card using this info

Development Info (v1.2)
If anyone wants to build upon this mod (with attribution) or is just interested in how this works, the following steps were used:
  • Extracted Interface\securetrade.swf from Data\SeventySix - Interface.ba2 using Archive2
  • Used JPEXS to open securetrade.swf file
  • Opened scripts/SecureTrade.as
  • Selected the UpdateItemCard function
  • Manually edited the P-Code for this function to:
    • Detect the "$wt" (pre-translated "Weight") item info property
    • Get the count of the currently selected list entry
    • Compute the stack weight from this info for counts more than 1
    • Append the stack weight to the weight string being displayed (this eventually ends up as an ItemCard_Standard)
  • Saved and repacked to a new archive using Archive2