Commit Graph
41 Commits
Author SHA1 Message Date
David Cernat 6df875f9c2 [General] Use inventoryHelper.addItem() whenever possible
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()
2018-10-19 21:25:04 +03:00
David Cernat ffb80e30be [EventHandler] Reinstate kicks for unlogged players sending ObjectLock
This should no longer cause any problems as of TES3MP/openmw-tes3mp@d9dd7073cf
2018-10-13 15:44:12 +03:00
David Cernat b1783cc8dd [General] Don't save players twice on cell changes
Additionally, log all player saving.
2018-10-13 12:25:09 +03:00
David Cernat b368b386d9 [General] Update names for script functions that clear packet vectors 2018-10-03 02:28:54 +03:00
David Cernat 837d9bfd71 [General] Use LoadItemChanges() instead of LoadInventory() when possible 2018-10-02 13:15:12 +03:00
David Cernat 60224a06e8 [EventHandler] Don't resend entire inventory when players create records
This prevents bugs related to invalid item indexes in the potion creation window.
2018-10-01 18:58:53 +03:00
David Cernat c15af56892 [General] Remove unnecessary usage of tes3mp.GetName() 2018-09-21 04:23:04 +03:00
David Cernat 46698c1d18 [General] Shorten long lines 2018-09-21 04:16:48 +03:00
David Cernat 4dc340480e [General] Change code style by using "not" operator whenever possible 2018-09-21 03:14:24 +03:00
David Cernat 1c3e9ac808 [General] Clean up logging by using easily adjustable log level values 2018-09-08 19:11:27 +03:00
David Cernat 9cd5dc8556 [General] Implement dynamic records, part 2
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.
2018-08-30 03:32:58 +03:00
David Cernat 6684326e5e [General] Rename BaseWorld's loadedRegions into storedRegions
There was a discrepancy in the meaning of "loaded" between the LoadedCells table and BaseWorld's loadedRegions table. The former contained only currently loaded cells, while the latter contained all the regions that had ever been loaded since the start of the server. To remove the inconsistency, the latter has been renamed.
2018-08-27 23:16:01 +03:00
David Cernat c3f4f771cc [General] Rename guiIds into guiHelper 2018-08-27 22:35:19 +03:00
David Cernat a54d498f76 [General] Add server owner rank & commands for promoting/demoting admins
Additionally, remove unused PromoteModerator() method in BasePlayer.
2018-08-27 15:33:27 +03:00
David Cernat 2142b14968 [General] Log chat names instead of pids for players whenever possible 2018-08-26 07:55:53 +03:00
David Cernat a46e9b9e2b [General] Combine methods for saving spellbook packets into a single one 2018-08-18 11:35:32 +03:00
David Cernat ed23c1a69f [General] Use consistent capitalization for function names, part 2 2018-08-13 06:38:45 +03:00
David Cernat 857248e57d [General] Reuse disallowedNameStrings for custom item names
Players are not just prevented from using certain strings in their own names, but also prevented from using them in the names of the items they create through regular gameplay.

logicHandler's IsPlayedNameAllowed method has been renamed into IsNameAllowed to reflect the change.
2018-08-12 03:27:57 +03:00
David Cernat b891ba098c [General] Add basic handling of OnPlayerItemUse event 2018-08-09 18:26:04 +03:00
David Cernat 999ac67cb8 [General] Add config option for coloring Admin and Mod denoters in chat
Change the order of requires in serverCore so that colors are loaded before the config.

Update wording in logicHandler.CreateObjectAtLocation() description so it refers to an object list instead of an event.
2018-08-05 20:56:30 +03:00
David Cernat 312834b97b [EventHandler] Print draw state and sneak state when activating objects 2018-08-03 19:32:35 +03:00
David Cernat 426187a171 [General] Implement dynamic records, part 1
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.
2018-07-31 17:46:29 +03:00
David Cernat de4cab5d20 [EventHandler] Kick players who use console for objects when disallowed
To clarify, if a player who has been disallowed from using the console by the server sends an ObjectPacket that has the console as its packetOrigin, that player will be kicked.

This doesn't prevent packet spoofing, but creates extra work for people trying their hand at modified clients.
2018-07-23 21:39:56 +03:00
David Cernat 21f78bfc56 [EventHandler] Don't read received object list twice in OnObjectLock 2018-07-23 20:33:35 +03:00
David Cernat 95b4849d95 [General] Save certain data to unloaded cells if its origin is valid
More specifically, Container, ObjectState and ObjectLock packets that were sent as a result of clientside dialogue or global scripts will be saved to serverside cell data.

With the new container sync that requires all items to be stored in the serverside cell data before they can be removed by clients, quests adding items to containers such as the Thieves Guild's "Loot the Mages Guild" were broken. This commit fixes them.
2018-07-23 06:57:58 +03:00
David Cernat 850a5bbe16 [General] Ignore empty regions when setting region authority 2018-07-21 18:27:27 +03:00
David Cernat db613ae278 [EventHandler] Add isValid boolean to OnObjectActivate for clarity 2018-07-21 09:37:20 +03:00
David Cernat e38ddddf6f [General] Move object-processing code from BaseCell to eventHandler 2018-07-21 07:57:07 +03:00
David Cernat 27af81bb34 [General] Implement weather sync and setting of region authorities 2018-07-21 05:34:25 +03:00
David Cernat 00ee9a0d63 [General] Move player disconnect logic from serverCore to eventHandler
Additionally, stop running OnPlayerCellChange on the disconnected player, and simply run individual state saving functions.
2018-07-18 00:32:18 +03:00
David Cernat 0a2eeca2fb [General] Switch to using OnWorldKillCount instead of OnPlayerKillCount
Additionally, fix a typo in BaseCell:ProcessObjectsActivated()
2018-07-15 05:36:26 +03:00
David Cernat 3bd0c98cab [General] Add handling of ObjectActivate packets 2018-07-15 03:16:58 +03:00
David Cernat f27fed7048 [General] Move all handling of player-sent messages to eventHandler 2018-07-14 21:59:20 +03:00
David Cernat 9500e68461 [Player] Rename Registered() into Register() 2018-07-14 20:10:02 +03:00
David Cernat bb62a5abc7 [General] Replace deprecated functions for reading last received packets 2018-07-13 02:45:48 +03:00
David Cernat fa1286f3a3 [General] Replace deprecated actor and object list functions w/ new ones 2018-07-13 01:38:57 +03:00
David Cernat 25e2a86c77 [General] Synchronize ActorAI packets received from clients 2018-07-13 01:26:27 +03:00
David Cernat 5ff3d2f0a1 [General] Rename remaining logic-handling myMod into logicHandller 2018-07-11 03:23:21 +03:00
David Cernat 327fd28930 [EventHandler] Avoid having overly long lines 2018-07-11 03:19:01 +03:00
David Cernat 1358fff3f8 [EventHandler] Remove unused OnPlayerDeny 2018-07-11 03:07:39 +03:00
David Cernat 6b6635db40 [General] Move event-handling from myMod to new eventHandler file 2018-07-11 03:00:08 +03:00