updating /permit logic to be closer to retail by default #3138
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently in ACE, when a player uses /permit to grant access to another player to loot their corpse, this permission remains in effect until it automatically expires after 1 hour, the permitter removes the permission, or the permittee logs out.
In retail, after the permittee opened a locked corpse of the permitter, their permission for other locked corpses of the permitter was revoked at that point.
There are a few details with this, thank you very much to the community for having a discussion about this in Discord for figuring out the details:
When a permittee opens/closes the locked corpse of a permitter, the corpse does not become available for anyone to access afterwards. Thus, it differs from the corpse owner opening/closing their corpse in this way. When a corpse owner opens/closes their corpse, it is then available for anyone to open afterwards.
However, when a permittee opens/closes a locked corpse of a permitter, even though the permitter is then removed from the permittee's LootPermissions table, the permittee still has access to repeatedly open/close the corpse they gained access to. With this combination of factors, the 'permitteeOpened' table was added to Corpse
The LootPermissions table remains stored on the permittees, same as it was before in ACE, which matches retail. If the permitter logs out, the permittee continues to have access to open 1 locked corpse. If the permittee logs out, they lose their granted permissions, same as in retail. Reference: http://acpedia.org/wiki/Death_and_Corpse_Commands
A new server option has also been added, permit_corpse_all, which defaults to false, as per retail. If the server operator wishes to restore previous behavior in ACE, where /permit grants access to all corpses instead of 1 corpse, this can be optionally set to True.
This PR also adds some logic that was possibly missing to Corpse.Close() for player corpses. After a corpse owner loots their own corpse (opener == victimId), the corpse should then supposedly become available for anyone to open afterwards.
TODO: when LootPermissions expires, a message was sent to the permittee that they no longer have access to loot the corpses of permitter. This would require some kind of LootPermissions_Heartbeat on the permittees. Find out if this message was sent only if the permissions expired naturally, or if it was also sent after successfully opening a permitted corpse.
This PR was tested programmatically via unit testing