Commit Graph

213 Commits (0.7.0)

Author SHA1 Message Date
David Cernat e96091fd6b [General] Use more consistent variable names for password, address, etc. 6 years ago
David Cernat 995d20348f [General] Always use correct ranged weapon & ammo for ranged attack sync
Previously, the player's currently selected weapon was being used in ranged attacks as in the original melee-oriented attack sync, which meant that shooting one type of projectile and then equipping another while the old projectile was still in the air turned the old projectile into the new projectile upon impact.

Additionally, avoid running most of the code in MechanicsHelper::assignAttackTarget() for non-hitting melee and ranged attacks.
6 years ago
David Cernat b5f46ada73 [General] Synchronize projectile speed for ranged attacks
This is done by including the final attackStrength used for ranged attacks in packets and then applying it in WeaponAnimation::releaseArrow() on other clients.
6 years ago
David Cernat fcd31bf4a6 [General] Fix problems with the synchronization of ranged attacks
Projectile hits now send Attack packets with RANGED attacks, and their success or failure is now synchronized.

Strike enchantments no longer require a valid victim to be synchronized.

Additional debug messages have been added for attacks.
6 years ago
David Cernat 8012d0d7b7 [General] Include hit position in PlayerAttack and ActorAttack packets 6 years ago
David Cernat 3bd8aa82fe [General] Reduce inventory-sending hooks to just 2 in ContainerStore
Whenever an item is added to or removed from the player's ContainerStore, that player sends a PlayerInventory packet with just that addition or removal.

This eliminates all the unnecessary packet spam related to oversized PlayerInventory packets that had existed in one form or another since the initial implementation of inventory sync in 1b259e2d33

Additionally, move booleans from BasePlayer to LocalPlayer when they are only needed on the client, and make the usage of the isReceivingQuickKeys boolean consistent with the new isReceivingInventory boolean by having them both in the processors of their associated packets.
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 888e1dfff8 [General] Allow setting of AI fight & dynamic stats in record packets
Additionally, allow the setting of the Autocalc flag for an NPC record based on an existing record.
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.
7 years ago
David Cernat d93b67ef21 [General] Sync soul refIds for items and add related script functions 7 years ago
David Cernat b4802e4201 [General] Use Time struct for time in BaseWorldstate 7 years ago
David Cernat a4b588d1b5 [General] Add optional timestamps to journal entries in PlayerJournal 7 years ago
David Cernat 3165c84db4 [General] Rework PACKET_ORIGIN enum
Additionally, comment out reading of originClientScript in ObjectPacket for now.
7 years ago
David Cernat 3dc2d1b214 [General] Add packetOrigin and originClientScript to ObjectList packets
Additionally, add script functions for getting the packetOrigin and originClientScript of received ObjectList packets.
7 years ago
David Cernat cb6c37a26d [General] Replace doubles with floats in BaseStructs and BaseWorldstate 7 years ago
David Cernat 20e0100706 [General] Rework Attack packets and add synchronization for item magic 7 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.
7 years ago
David Cernat 9823a77bf2 [General] Turn PlayerRegionAuthority into WorldRegionAuthority
WorldRegionAuthority is a Worldstate packet.
7 years ago
David Cernat 6ebe09375f [General] Implement ObjectActivate packet & associated script functions 7 years ago
David Cernat 528bd26a3b [General] Allow followers to follow non-authority players through cells 7 years ago
David Cernat 09da24f1ea [General] Rename all instances of refNumIndex into refNum
This creates symmetry with mpNum and should cause less confusion in the future.
7 years ago
David Cernat bdf2f03c4f [General] Remove unnecessary MapChanges struct from BaseWorldstate 7 years ago
David Cernat bff6e9e235 [General] Implement ActorAI packet, part 5
Allow repetition for AiWander package to be turned on and off.
7 years ago
David Cernat 00c13ae96c [General] Implement ActorAI packet, part 4
The server can now make actors activate players and objects, at least in theory. In practice, OpenMW''s AiActivate package needs to be worked so it allows specific objects as targets instead of just refIds.
7 years ago
David Cernat 0e13207afe [General] Implement ActorAI packet, part 3
The server can now cancel actor AI, make actors travel to a location, make actors wander, and make actors get escorted by a player or another actor.
7 years ago
David Cernat 5baef09f79 [General] Implement ActorAI packet, part 2
The server can now make actors start combat with players or other actors.
7 years ago
David Cernat 3ed9d89280 [General] Use separate variables for video & music filenames in packets 7 years ago
David Cernat c075496748 [General] Replace deathReason in death packets with a killer variable
Add serverside script functions for determining the killers of both players and actors.

Use unsigned ints for script functions returning an object or actor's refNumIndex or mpNum.

Remove updateDeadState() from LocalPlayer and make its code part of updateStatsDynamic() for simplicity.
7 years ago
David Cernat f02492a593 [General] Temporarily include target names in mwmp::Target
These will be removed once the server can get the names matching refIds by reading content files.
7 years ago
Koncord f9ff5f10df [General] Reduce packets size and add integrity checks 7 years ago
Koncord c69819e0db [General] Change type of refNumIndex & mpNum to unsigned 7 years ago
David Cernat bef53749ed [General] Replace BaseObject's hasMaster variable with isSummon
Additionally, add a GetObjectSummonState() script function to the server.
7 years ago
David Cernat 958b220835 [General] Send summon duration to server in ObjectSpawn packets 7 years ago
David Cernat 9102df7fde [General] Make WorldCollisionOverride also work with specific refIds
For now, this only makes it possible to enforce collision for specific refIds for placed objects.
7 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.
7 years ago
David Cernat 914b79fcc9 [General] Make it possible to check which placed objects have containers 7 years ago
David Cernat d53bd05424 [General] Use slightly larger maximum imageData size in WorldMap packets 7 years ago
David Cernat 5bb2ba1e9e [General] Limit maximum imageData size in WorldMap packets 7 years ago
David Cernat 72862dc255 [General] Turn PlayerMap into WorldMap, now a Worldstate packet 7 years ago
David Cernat 494edbe5cb [General] Add REPLY_TO_REQUEST container sub-action 7 years ago
David Cernat 3efe05a88e [General] Implement WorldCollisionOverride packet 7 years ago
David Cernat 3b5fb9cd6b [General] Make it possible to set year via WorldTime 7 years ago
David Cernat 4acf93b7db [General] Make it possible to set days passed via WorldTime 7 years ago
David Cernat 46744ee90f [General] Make WorldTime script functions more consistent with others 7 years ago
David Cernat 8d36d0d945 [General] Make it possible to change world's time scale via WorldTime 7 years ago
David Cernat 5af1150ab2 [General] Turn GameTime into a Worldstate packet 7 years ago
David Cernat 43a944ddaf [General] Add and implement new Worldstate packet type 7 years ago
David Cernat 78234f9071 [General] Rename Event into ObjectList & WorldObject into BaseObject 7 years ago
David Cernat 77389538e8 [General] Implement ActorAI packet, part 1
The server can now make actors become followers of players or other actors.
7 years ago
David Cernat 715012f087 [General] Implement sending of image data for map tiles in PlayerMap 7 years ago