Commit Graph

116 Commits (a508a0faf8c09fc23ddecb1df3044045f3835e0f)

Author SHA1 Message Date
David Cernat a508a0faf8 [Server] Turn GetArguments() from ScriptFunctions into Utils function 5 years ago
Koncord 55cea491ca [Server] Introduce MS VC++ 2017 support 5 years ago
Koncord e162af0003 [Server] Disallow non void callbacks 6 years ago
Koncord 07a5f5296c [Server] Rework OnRequestPluginList callback. Add AddPluginHash function 6 years ago
Koncord 20a7619a4a [Server] Remove result from the OnPlayerConnect callback
Now it's recommended to use tes3mp.Kick() function
6 years ago
Koncord f1e8569291 [Server] Remove result from the OnPlayerSendMessage callback 6 years ago
Koncord efa362031e [Server] Remove unused Main callback 6 years ago
David Cernat 8df08c7d10 [General] Implement PlayerItemUse packet
Players can no longer unilaterally use items on themselves in their inventory. When they try to use an item, they send a PlayerItemUse packet to the server with the item's details. A serverside script can then check the item and either send the packet back to make the item use go through or drop it.
6 years ago
David Cernat b57807407a [General] Implement RecordDynamic packet, part 1
Spell, potion, enchantment, creature, NPC, armor, book, clothing, miscellaneous and weapon record data can now be sent in a RecordDynamic packet. Additionally, the packets include data related to associated magical effects (for spells, potions and enchantments), data related to default inventory contents (for creatures and NPCs) and data related to body parts affected (for armor and clothing).

The server now has associated script functions for setting most of the details of the above, with the main exception being individual creature and NPC stats.

Records can either be created entirely from scratch or can use an existing record (set via the baseId variable) as a starting point for their values. In the latter case, only the values that are specifically set override the starting values. Creature and NPC records also have an inventoryBaseId that can be used on top of the baseId to base their inventories on another existing record.

The client's RecordHelper class has been heavily expanded to allow for the above mentioned functionality.

When players create spells, potions and enchantments as part of regular gameplay, they send RecordDynamic packets that provide the server with the complete details of the records that should be created. When they create enchantments, they also provide the server with armor, book, clothing and weapon records corresponding to the items they've enchanted.

This functionality added by this packet was originally supposed to be exclusive to the rewrite, but I've gone ahead and tried to provide it for the pre-rewrite in a way that can mostly be reused for the rewrite.
6 years ago
David Cernat 892d71ce71 [General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e2 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.

My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.

However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
6 years ago
David Cernat 3649cf553f [General] Rename PlayerKillCount into WorldKillCount
This should clarify the real meaning of the packet and its associated event.

The event itself has been renamed from OnPlayerKillCount to OnWorldKillCount.
6 years ago
David Cernat 81b160cae8 [General] Add placeholder for ObjectActivate packet 6 years ago
David Cernat 61da0d2475 [General] Turn PlayerInteraction into PlayerInput 6 years ago
David Cernat 837c5369c0 [Server] Add OnActorAI event and remove autosync for ActorAI packets 6 years ago
David Cernat 141e404ed9 [Server] Move server administration functions to ServerFunctions class 6 years ago
David Cernat 6041425122 [Server] Move Chat functions to new ChatFunctions class 6 years ago
David Cernat 6a3fbf4e98 [Server] Use consistent arguments for script functions that send packets
Previously, there was a confusing separation between script functions that had a "broadcast" argument and script functions that had a "toOthers" argument.

Those with broadcast sent the packet to all players on the server when broadcast was true. Those with toOthers sent the packet to all players other than the packet's attached player.

The former was based on the pattern of the original SendMessage() script function. The latter more closely resembled RakNet's own broadcast argument as seen here:

https://github.com/TES3MP/CrabNet/blob/master/include/raknet/RakPeer.h#L219

This commit makes it so all sending functions have a sendToOtherPlayers argument that is false by default and a sendToAttachedPlayer that is true by default. This should simultaneously allow sending to be more intuitive, while not breaking previous existing scripts to a significant degree.

Additionally, this commit also reduces some code repetition for all instances of packet-fetching in script functions.
6 years ago
David Cernat 7f0549fc4f [Server] Remove hardcoded sync for VideoPlay and add OnVideoPlay event 6 years ago
Koncord 685a80887b Remove Pawn support 6 years ago
David Cernat 7ffdb18bf9 [General] Implement ActorDeath packet, part 1
ActorDeath packets are sent for dead actors before their StatsDynamic packets. They contain the actor's deathReason in a manner similar to that of PlayerDeath packets.

A future commit will replace the deathReason with a variable named killer which will be an mwmp::Target.
6 years ago
David Cernat 72862dc255 [General] Turn PlayerMap into WorldMap, now a Worldstate packet 6 years ago
David Cernat bef36f77ca [Server] Create WorldstateFunctions and move GameTime functions there 6 years ago
David Cernat d4f7936a76 [Server] Rename WorldFunctions into ObjectFunctions 6 years ago
David Cernat 306252ecdc [Server] Fix confusing script function names 6 years ago
David Cernat 311f770de7 [Server] Document script functions, part 4
Additionally, clean up some variable names.
6 years ago
David Cernat 76e7392a84 [Server] Create ShapeshiftFunctions and move relevant functions there 6 years ago
David Cernat 88ae0772cf [Server] Initialize new processors and fix issues with RecordDynamic 6 years ago
David Cernat 02af7f6ba1 [General] Add placeholders for new packet types 6 years ago
David Cernat 50d5fffb7f [General] Add and implement PlayerQuickKeys packet 7 years ago
David Cernat 9d05063af4 [General] Add server script functions for banning & unbanning IPs
Additionally, use a more informative message for the client when trying to connecting to a server that it is banned from.
7 years ago
David Cernat 43a3daf0aa [General] Add & implement PlayerShapeshift packet for werewolf states 7 years ago
David Cernat 3280f0c5ee [General] Implement PlayerJail packet
Rework server's DeathFunctions into MechanicsFunctions

Remove connection between PlayerResurrect and jailing
7 years ago
Koncord 9cc07f100c [Server] Add OnObjectState callback 7 years ago
Koncord 940ae5c2fb [Server] Implement GetIP API function 7 years ago
Koncord 5292914325 [Server] Simplify native CallPublic & CreateTimerEx 7 years ago
David Cernat 813a3c89c4 [General] Implement PlayerBook packet to track skill books read 7 years ago
David Cernat b3b73c5cd2 [General] Implement resurrection at nearest shrine or temple 7 years ago
David Cernat 48c63dbce9 [General] Fix ObjectLock packets by making hasCellData true for them 7 years ago
David Cernat 4ad87faac1 [Server] Create new Settings category for script functions 7 years ago
Koncord 3803535bd5 [General] Implement CleanChat() 7 years ago
David Cernat 5b23da8e1c [General] Rename unused PlayerRegionChange packet into PlayerKillCount 7 years ago
Koncord cef58fa164 [Server] Change fprintf to LOG_MESSAGE_SIMPLE in GET_PLAYER 7 years ago
David Cernat 4e5c8873e0 [General] Use ObjectSpawn instead of ObjectPlace for actors 7 years ago
David Cernat 27148ce9eb [General] Add placeholders for 12 new packets, to be implemented soon
Additionally, make it slightly clearer who created which previously existing packets.
7 years ago
David Cernat f47a10dd4a [Server] Add script callback and getter functions for ActorEquipment 7 years ago
David Cernat dbdb11b5f0 [Server] Add script functions for dialogue 7 years ago
David Cernat 08de349133 [General] Add placeholders for PlayerTopic & ObjectTrap packets 7 years ago
David Cernat 870fd9a78b [General] Remove ObjectUnlock packet, use ObjectLock with 0 lock instead 7 years ago
David Cernat a2e2ca7cab [Server] Add script functions for factions 7 years ago
David Cernat 90c594b726 [Server] Make names for Player script callbacks shorter 7 years ago