=== Stash object inventory Functions ===– These functions manipulate the contents of the Stash Containers in-game.
vSS_API_Stash::ExportStash |
( |
String |
asUUID, |
|
|
Bool |
abSkipBackup = False |
|
) |
| |
|
inlinestatic |
Exports the data for the specified Stash to a file.
- Parameters
-
asUUID | The UUID of the Stash. |
abSkipBackup | If True, don't do the usual file rotation before writing. Default: False. |
- Note
- This should usually be called right after UpdateStashData();
Int vSS_API_Stash::ImportStashRefItems |
( |
ObjectReference |
akStashRef, |
|
|
Bool |
abForce = False |
|
) |
| |
|
inlinestatic |
Populate akStashRef with the Stash items.
- Parameters
-
akStashRef | The ObjectReference of the Stash. |
abForce | Populate the Container even if the script already thinks it's up to date. Default: False. |
- Returns
- The number of ItemEntries placed in the Container, or 0 for an invalid Stash.
- Note
- If the Container already contains items, its inventory will be merged with the Stash contents. This new item list will NOT be saved until the Player opens the Container, though.
Int vSS_API_Stash::LoadStashesForCell |
( |
Cell |
akCell | ) |
|
|
inlinestatic |
Find and populate all the Stash Containers for the specified Cell.
- Parameters
-
akCell | The Cell to load the Stashes for. |
- Returns
- The number Stashes loaded for the Cell.
- Warning
- Do not attempt to use this for a Cell that is not currently loaded! ObjectReferences for unloaded Cells return None, so they will NOT get populated properly!
- Note
- Depending on the number of Stashes and how many items are in them, this may takes some time to return. Under normal circumstances it should still be less than a second, though.
Also cleans up any StashRefs which no longer have valid Stash entries, and will strip the Stash effect from non-Stash containers.
Int vSS_API_Stash::ScanContainer |
( |
ObjectReference |
akStashRef | ) |
|
|
inlinestatic |
For anyone reading this, I had this whole scan working perfectly in pure Papyrus. It was beautiful. It used several containers working in parallel to sort and scan everything. For Papyrus, it was blindingly fast. By any realistic standard, though, it was also mind-numbingly slow. Call it a moral victory. At any rate, I gave up on doing it in pure Papyrus and instead learned c++ well enough to reimplement it in an SKSE plugin. Now it's nearly instantaneous. So it goes.
Creates a new JMap containing the ItemEntries for the specified Container.
- Parameters
-
akStashRef | The ObjectReference of the Stash. |
- Returns
- The ID of a new JMap containing the Stash Container's contents.
- Warning
- The JMap is not set to be retained, so it will expire unless written to the JDB or otherwise marked for retention.
- Note
- Although this was written to be used on a newly created Stash, it can be used on any Container to quickly get its contents.
Int vSS_API_Stash::UpdateStashData |
( |
String |
asUUID | ) |
|
|
inlinestatic |
Updates the stored data for the specified Stash based on its Container contents.
- Parameters
-
asUUID | The UUID of the Stash. |
- Returns
- The ItemEntry count of the Stash, or 0 for a problem.
- Note
- This updates the stored data for a Stash, doing a full inventory scan and ticking the data version. It also updates the various metadata to reflect the currently loaded character and Session. It does not write the Stash data to a file, only the persistent Registry.
- This is a resource-intensive function and should be used only when the contents of the Stash's Container have been changed.