Commit Graph

263 Commits (01804af100785bc2c162d568258d9662012627a3)

Author SHA1 Message Date
David Cernat 01804af100 [Client] Add updateInventoryWindow() method to LocalPlayer 5 years ago
David Cernat f29bfb6b8e [Client] Add debug for received kill counts 5 years ago
David Cernat 9fc4c83858 [Client] Send skill/attribute packets when skills/attributes are damaged 5 years ago
David Cernat 6e47b65205 [Client] Set attribute increases & level progress after correct packets
Originally, the PlayerSkill packet contained skills, attribute increases and level progress. In 78441c769a, the attribute increases were moved to the PlayerAttribute packet and the level progress was moved to the PlayerLevel packet, but – due to an oversight – attribute increases and level progress were still being applied to the local player only when a PlayerSkill packet was received, based on whatever values were stored from the last PlayerAttribute and PlayerLevel packets.
5 years ago
David Cernat 8a99f215f6 [Client] Add LocalPlayer::sendItemChange() variant with mwmp::Item arg 5 years ago
David Cernat 343dd8b5ea [Client] Fix addition of items to player inventories
Previously, multiple stacks of the same item ID could overwrite data in each other because of how the logic in ContainerStore::add() works. For example, a stack of 5 grand soul gems with no souls would get added to the player, then the attempt to add a grand soul gem with a particular soul would retrieve the previous stack first before setting all of it to that soul, resulting in 6 grand soul gems with that soul.
5 years ago
David Cernat d05a82a734 [Client] Avoid repetitive code when unequipping items in resurrection 6 years ago
David Cernat b39e3f518b [Client] Use correct log levels for inventory and dynamic record packets 6 years ago
David Cernat 17f13872aa [Client] Use forceUpdate correctly in LocalPlayer::updateStatsDynamic()
Previously, the forceUpdate argument was useless, preventing dynamic stats from being sent by certain newly created characters.
6 years ago
David Cernat d9dd7073cf [General] Send certain packets only when logged in
Previously, client mods adding packet-sending scripts to the spawn area made clients send the associated packets as soon as they inputted their character name when joining a server using those mods. This made the clients either get disconnected for not replying to a handshake first, or it made them get kicked for sending object packets that are disallowed for players who are not logged in.

To fix this, LocalPlayer's hasFinishedCharGen() has been replaced with isLoggedIn(), because the former was already returning true when players inputted their names.
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 03832f933b [Client] Send only individual items in PlayerInventory packets
For a long time, whenever a PlayerInventory packet was sent, it contained all the items in the player's inventory, because that's how Koncord originally implemented it and I always had too many other priorities to go back and rework it.

From now on, clients only send PlayerInventory packet with the one item added or removed, with the single exception being trading with merchants, where the entire inventory is still sent for the time being.
6 years ago
David Cernat 45b011452e [Client] Combine methods for sending spell packets into a single one 6 years ago
David Cernat 9598212aad [Client] Don't add bound items to inventory as a result of item packets
Additionally, don't include bound items when sending PlayerInventory packets.
6 years ago
David Cernat a1933e7bc2 [Client] Don't declare variable twice in LocalPlayer's setEquipment()
The variable equipmentItem is identical to currentItem, so it should not have been added in commit 58a6a8c3bc

Addditionally, use a more descriptive variable name than "a" for item Ptrs.
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 d93b67ef21 [General] Sync soul refIds for items and add related script functions 6 years ago
David Cernat a4b588d1b5 [General] Add optional timestamps to journal entries in PlayerJournal 6 years ago
David Cernat 8fbed1f808 [General] Remove custom data from PlayerSpellbook packet
It has never made sense to have custom spell data in PlayerSpellbook packets, so it has been removed.
6 years ago
David Cernat 8c0b75d9f4 [Client] Limit PlayerEquipment packets sent by recharging enchantments 6 years ago
David Cernat 038757b91a [General] Temporarily revert to original rotation animation sync
I originally added rotation animation sync as part of commit 068a45be87. Unfortunately, it meant the PlayerPosition packets were now twice as large as they had been before, which was less than ideal for such a frequently sent packet, which is why Koncord switched to a more optimized approach in commits 5f30dfd5db and d67db1a9bd.

Recently, there have since been some rotation animation problems in OpenMW, which have broken the way Koncord's approach looks. My original approach still looks somewhat okay, so I'm switching back to it until we can figure out how to reuse it under the current circumstances.
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 09da24f1ea [General] Rename all instances of refNumIndex into refNum
This creates symmetry with mpNum and should cause less confusion in the future.
6 years ago
David Cernat 59a56ca35e [Client] Disallow clients from scaling their associated players
Additionally, display messages when trying to scale players.
6 years ago
David Cernat 4b30a44816 [Client] Compare crimeTime and deathTime when NPCs forgive player crimes
Previously, all crime witnesses stopped being hostile to a respawning player for as long as the player's diedSinceArrestAttempt was true. That meant that, in an area with no guards to arrest the player, crime witnesses did not enage in combat with the player at all ever again until diedSinceArrestAttempt became false.

This commit makes it so the time of the last crime is recorded for each witness, and that is then compared with the time of the LocalPlayer's last death for a one-time crime forgiveness during that player's current life.

This is essentially a gameplay adjustment for "singleplayer with respawns," and will have to be reworked to make sense for every player in multiplayer, though that requires reworking the crime system as a whole and is thus on hold.
6 years ago
David Cernat 17c234d9ca [Client] Use initial values for LocalPlayer and LocalActor killers 6 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.
6 years ago
David Cernat 72862dc255 [General] Turn PlayerMap into WorldMap, now a Worldstate packet 6 years ago
David Cernat 7f00005f04 [Client] Fix GCC build
Based on 71040659ac
6 years ago
David Cernat 715012f087 [General] Implement sending of image data for map tiles in PlayerMap 6 years ago
David Cernat df0f9b0f5e [Client] Require a certain Skill progress amount before sending packet 6 years ago
David Cernat 099f85be0a [General] Implement PlayerMomentum packet & associated script functions 6 years ago
David Cernat 3b07dc4b42 [Client] Send equipment packets whenever an item charge or count changes
Since the beginnings of TES3MP, equipment packets have only been sent whenever an item has been replaced by an item with a different refId, with changes in an item's charge or count not sending a packet (but being included in the next packet sent as a result of a refId change). The reason for this was ostensibly the fact that every single equipment packet always included the details for all 19 equipment items (as per Koncord's original design decision), which would have led to massive packet spam if such a packet was sent every time you shot an arrow or lost a little bit of your armor's condition.

With minimalist equipment packets, it is now viable to send equipment packets whenever any item changes in some way, by having the equipment packet contain only that one item.
6 years ago
David Cernat 399e049d87 [Client] Fix logic for minimal size packets in LocalPlayer
Previously, the index changes were not cleared at the start of their corresponding update functions, which in turn meant that an Attribute/Skill/StatsDynamic/Equipment packet received by a player from the server made that player send back the same packet, as the index changes from it were retained.

Additionally, exchangeFullInfo was not set to false, thus sometimes leading to constant full exchanges of information.
6 years ago
David Cernat 608dcbafe6 [Client] Fix skill updates for LocalPlayer partially broken by 78441c769a 6 years ago
David Cernat a541d7df3c [General] Rework PlayerStatsDynamic packets so they are of minimal size
(cherry picked from commit fc5e883160)
6 years ago
David Cernat b9520c11da [General] Rework PlayerEquipment packets so they are of minimal size
Moreover, rename BaseNetCreature's equipedItems into equipmentItems.

(cherry picked from commit d1ad0c91f8)
6 years ago
David Cernat c5b08d6109 [General] Simplify storing of attribute and skill index changes
(cherry picked from commit bd9e8bd10f)
6 years ago
David Cernat 2c77d5f498 [General] Set enforcedLogLevel to -1 when initializing BasePlayer 6 years ago
David Cernat b6099024df [General] Rework PlayerAttribute packets so they are of minimal size
Previously, whenever a single attribute value changed for a player, that player then sent a PlayerAttribute packet with all values for all 8 attributes.

This did not cause anywhere as much packet spam as PlayerSkill used to, but there was no good reason not to fix it as well.

(cherry picked from commit b0965f094a)
6 years ago
David Cernat 78441c769a [General] Rework PlayerSkill packets so they are of minimal size
Previously, whenever a single skill value changed for a player, that player then sent a PlayerSkill packet with all values for all 27 skills, plus the player's progress towards the next level and the bonuses to each attribute on the next level up as the result of sklll increases thus far.

This commit makes PlayerSkill contain only the values of specific skills, moves the player's progress towards the next level to PlayerLevel packets, and moves the bonuses to each attribute on the next level up to PlayerAttribute packets.

Players now also send a PlayerSkill packet whenever their progress towards a new point in a skill changes. This was previously avoided so as to not have massive packet spam.

(cherry picked from commit ef79a98544)
6 years ago
David Cernat af4fcb7261 [Client] Don't force skill update on cell change
Previously, an attempt by the server to simultaneously change a player's cell and skills (as you'd expect when a player file is loaded) led to:

1) The server sending the cell packet first and the skill packet afterwards

2) The player receiving the cell packet and sending their own skill packet as part of the client's forced skill update

3) The player receiving the skill packet from the server

4) The server receiving the skill packet from the player

The result was that, if the player then left the server without sending another skill packet, the server's memory retained the skills the player had sent instead of the skills it had sent to the player.

This is the first step in a solution to that situation and similar ones.

(cherry picked from commit cac4684986)

Note: In 0.6.x, this was only a problem if a player's cell was set by the server first and their skills were set next, i.e. this was not a problem in the default CoreScripts because the opposite order used there masked the problem. It was a more significant problem in 0.7 because all packets were queued for a player and sent in a specific hardcoded order.
6 years ago
David Cernat 28f1c1b0d3 [General] Rework CharGen slightly for clarity purposes
Previously, charGenStage.end was doing double duty as both the variable indicating the number of CharGen stages and – when set to 0 – the variable indicating that CharGen was over. The latter role is now filled by a new boolean.

(cherry picked from commit 926106cf8c)
6 years ago
David Cernat 9d46de88e0 [Client] Send cell states correctly after inputting name
Previously, initial cell states were sent in LocalPlayer::processCharGen() and were ignored by the server because the player was not yet regarded as loaded. The result was that existing players logging in could not see each other until they went through at least one cell change.

(cherry picked from commit b4e8560698)

# Conflicts:
#	apps/openmw/mwmp/LocalPlayer.cpp
6 years ago
David Cernat 9697595857 [Client] Don't equip already equipped items in local setEquipment()
This avoids the following error when receiving repeated PlayerBaseInfo packets: "Error in frame: Invalid slot, make sure you are not calling RefData::setCount for a container object"

Additionally, only re-equip items as the result of a PlayerBaseInfo packet if resetStats is true (because of its side effect of auto-equipping items for the player).
6 years ago
David Cernat 73dea494c4 [General] Allow changes from PlayerBaseInfo without player stat reset 6 years ago
David Cernat 9165b12d78 [Client] Update inventory views when receiving inventory or equipment 6 years ago
David Cernat 20caea083a [Client] Use correct count for items in equipment packets
Previously, throwing weapon sync was completely broken for players, as the count for their equipped throwing weapons was never set and – as a result – defaulted to a count of 1 on other clients. As a result, any time a player threw a dart, they would then appear as having switched to hand-to-hand for other players.

Moreover, the count of equipped items was mistakenly based on the total count of items with that refId in the inventory. As a result, if – for example – I equipped 1 Daedric Longsword and had 4 others in my inventory, my DedicatedPlayer on other clients would equip a Daedric Longsword with a count of 5. If I was overencumbered by having that many Daedric Longswords on me and then dropped 4 of them, allowing myself to move again, my DedicatedPlayer would still walk around with 5 Daedric Longswords and lack animations due to still being overencumbered on the other clients.

These problems were less prevalent for actors, but their equipment updating code has also been changed to match that of players.
6 years ago
David Cernat b249162ca1 [General] Implement setting of enforced client log level in GameSettings
Certain servers do not want the players to have debug information about the locations and actions of other players, so a client's log level can now be enforced by the server via the GameSettings packet.
6 years ago
David Cernat 03266d7648 [Client] Prevent guards from arresting players who are currently jailed 6 years ago