This fixes a significant bug where every custom potion created through regular gameplay was placed in its own slot in the player's inventory table, which – combined with the record removal logic in BasePlayer:SaveInventory() – made links to custom potions get removed prematurely.
Additionally, add debug information for every item change in BasePlayer:SaveInventory()
These were originally part of skill packets, but were moved to attribute packets in TES3MP/openmw-tes3mp@78441c769a without a corresponding change being made in the Lua scripts.
This now accounts for the fact that the level progress was moved from the PlayerSkill packet to the PlayerLevel packet in TES3MP/openmw-tes3mp@78441c769a
Previously, although player inventories without soul keys looked nicer and more compact, they complicateed the item-removal logic and caused item duplication.
Records are now split into 2 categories: permanent records and generated records.
Permanent records are kept forever once created and are sent to all players when they join the server.
Generated records are linked to players, cells or other records, are deleted once those links disappear, and are only sent to players who encounter them. For instance, if a player creates hundreds of potions in a house and then drops the potions there, those potion records will only be sent to players who enter that house. If the potions are drunk and there are no longer any instances of them, their associated records are deleted.
By default, permanent records are created by using the /createrecord command after specifically setting an ID for the record about to be created.
Generated records are created through regular gameplay or by using the /createrecord command without specifying an ID for the record.
Unlike what was thought when spellbook saving and loading was initially implemented, there is not going to be any extra information to store in player spellbooks, seeing as custom spell records have their own record store, so player spellbooks can be simplified.
A new RecordStore class has been implemented, used for saving and loading spell, potion, enchantment, creature, NPC, armor, book, clothing, miscellaneous and weapon record data, as well as accompanying magical effects (for spells, potions and enchantments), inventory items (for creatures and NPCs) and body parts (for armor and clothing). RecordStore data is kept in the new data/recordstore folder.
The OnRecordDynamic event has been implemented in eventHandler, with records received from players first being saved to their associated RecordStores, then being forwarded to players with their new server-set ids, and finally having their associated items added to the players they were received from.
Utility methods for getting and loading RecordStores have been added to logicHandler.
The commands /storerecord and /createrecord have been implemented for on-the-fly record creation.
The help menu has been expanded with examples for creating records.
All records are currently "global", i.e. when players join the server, they receive all the records created on it. This is a temporary, flawed approach that will be replaced with the correct approach in part 2.
Progress in exterior exploration is, as before, always saved to the data files of players. However, if config.shareMapExploration is enabled, that progress is now saved to and loaded from the world's data file instead.