Server: fix release_mode (#1407)

* Server: fix release_mode

* Core: actually rename forfeit to release across the program
This commit is contained in:
Fabian Dill 2023-01-24 03:36:27 +01:00 committed by GitHub
parent 1a44f5cf1c
commit 847582ff5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 32 additions and 32 deletions

View File

@ -193,7 +193,7 @@ class CommonContext:
self.hint_cost = None
self.slot_info = {}
self.permissions = {
"forfeit": "disabled",
"release": "disabled",
"collect": "disabled",
"remaining": "disabled",
}
@ -260,7 +260,7 @@ class CommonContext:
self.server_task = None
self.hint_cost = None
self.permissions = {
"forfeit": "disabled",
"release": "disabled",
"collect": "disabled",
"remaining": "disabled",
}

View File

@ -119,7 +119,6 @@ class Context:
"location_check_points": int,
"server_password": str,
"password": str,
"forfeit_mode": str, # TODO remove around 0.4
"release_mode": str,
"remaining_mode": str,
"collect_mode": str,
@ -141,7 +140,7 @@ class Context:
non_hintable_names: typing.Dict[str, typing.Set[str]]
def __init__(self, host: str, port: int, server_password: str, password: str, location_check_points: int,
hint_cost: int, item_cheat: bool, forfeit_mode: str = "disabled", collect_mode="disabled",
hint_cost: int, item_cheat: bool, release_mode: str = "disabled", collect_mode="disabled",
remaining_mode: str = "disabled", auto_shutdown: typing.SupportsFloat = 0, compatibility: int = 2,
log_network: bool = False):
super(Context, self).__init__()
@ -157,7 +156,7 @@ class Context:
self.player_names: typing.Dict[team_slot, str] = {}
self.player_name_lookup: typing.Dict[str, team_slot] = {}
self.connect_names = {} # names of slots clients can connect to
self.allow_forfeits = {}
self.allow_releases = {}
# player location_id item_id target_player_id
self.locations = {}
self.host = host
@ -174,7 +173,7 @@ class Context:
self.location_check_points = location_check_points
self.hints_used = collections.defaultdict(int)
self.hints: typing.Dict[team_slot, typing.Set[NetUtils.Hint]] = collections.defaultdict(set)
self.release_mode: str = forfeit_mode
self.release_mode: str = release_mode
self.remaining_mode: str = remaining_mode
self.collect_mode: str = collect_mode
self.item_cheat = item_cheat
@ -593,6 +592,8 @@ class Context:
def _set_options(self, server_options: dict):
for key, value in server_options.items():
if key == "forfeit_mode":
key = "release_mode"
data_type = self.simple_options.get(key, None)
if data_type is not None:
if value not in {False, True, None}: # some can be boolean OR text, such as password
@ -1229,7 +1230,7 @@ class ClientMessageProcessor(CommonCommandProcessor):
def _cmd_release(self) -> bool:
"""Sends remaining items in your world to their recipients."""
if self.ctx.allow_forfeits.get((self.client.team, self.client.slot), False):
if self.ctx.allow_releases.get((self.client.team, self.client.slot), False):
release_player(self.ctx, self.client.team, self.client.slot)
return True
if "enabled" in self.ctx.release_mode:
@ -1885,7 +1886,7 @@ class ServerCommandProcessor(CommonCommandProcessor):
player = self.resolve_player(player_name)
if player:
team, slot, name = player
self.ctx.allow_forfeits[(team, slot)] = True
self.ctx.allow_releases[(team, slot)] = True
self.output(f"Player {name} is now allowed to use the !release command at any time.")
return True
@ -1898,7 +1899,7 @@ class ServerCommandProcessor(CommonCommandProcessor):
player = self.resolve_player(player_name)
if player:
team, slot, name = player
self.ctx.allow_forfeits[(team, slot)] = False
self.ctx.allow_releases[(team, slot)] = False
self.output(f"Player {name} has to follow the server restrictions on use of the !release command.")
return True
@ -2053,7 +2054,7 @@ class ServerCommandProcessor(CommonCommandProcessor):
return input_text
setattr(self.ctx, option_name, attrtype(option))
self.output(f"Set option {option_name} to {getattr(self.ctx, option_name)}")
if option_name in {"forfeit_mode", "release_mode", "remaining_mode", "collect_mode"}: # TODO remove forfeit_mode with 0.4
if option_name in {"release_mode", "remaining_mode", "collect_mode"}:
self.ctx.broadcast_all([{"cmd": "RoomUpdate", 'permissions': get_permissions(self.ctx)}])
elif option_name in {"hint_cost", "location_check_points"}:
self.ctx.broadcast_all([{"cmd": "RoomUpdate", option_name: getattr(self.ctx, option_name)}])

View File

@ -43,7 +43,7 @@ class Permission(enum.IntFlag):
disabled = 0b000 # 0, completely disables access
enabled = 0b001 # 1, allows manual use
goal = 0b010 # 2, allows manual use after goal completion
auto = 0b110 # 6, forces use after goal completion, only works for forfeit
auto = 0b110 # 6, forces use after goal completion, only works for release
auto_enabled = 0b111 # 7, forces use after goal completion, allows manual use any time
@staticmethod

View File

@ -29,7 +29,7 @@ their game.
## What happens if a person has to leave early?
If a player must leave early, they can use Archipelago's forfeit system. When a player forfeits their game, all the
If a player must leave early, they can use Archipelago's release system. When a player releases their game, all the
items in that game which belong to other players are sent out automatically, so other players can continue to play.
## What does multi-game mean?

View File

@ -47,7 +47,7 @@
</label>
</td>
<td>
<select name="release_mode" id="forfeit_mode">
<select name="release_mode" id="release_mode">
<option value="auto">Automatic on goal completion</option>
<option value="goal">Allow !release after goal completion</option>
<option value="auto-enabled">

View File

@ -148,7 +148,7 @@ The next step is to know what you need to make the game do now that you can modi
- Listen for messages from the Archipelago server
- Modify the game to display messages from the Archipelago server
- Add interface for connecting to the Archipelago server with passwords and sessions
- Add commands for manually rewarding, re-syncing, forfeiting, and other actions
- Add commands for manually rewarding, re-syncing, releasing, and other actions
To elaborate, you need to be able to inform the server whenever you check locations, print out messages that you receive
from the server in-game so players can read them, award items when the server tells you to, sync and re-sync when necessary,

View File

@ -70,7 +70,7 @@ Sent to clients when they connect to an Archipelago server.
| version | [NetworkVersion](#NetworkVersion) | Object denoting the version of Archipelago which the server is running. |
| tags | list\[str\] | Denotes special features or capabilities that the sender is capable of. Example: `WebHost` |
| password | bool | Denoted whether a password is required to join this room.|
| permissions | dict\[str, [Permission](#Permission)\[int\]\] | Mapping of permission name to [Permission](#Permission), keys are: "forfeit", "collect" and "remaining". |
| permissions | dict\[str, [Permission](#Permission)\[int\]\] | Mapping of permission name to [Permission](#Permission), keys are: "release", "collect" and "remaining". |
| hint_cost | int | The amount of points it costs to receive a hint from the server. |
| location_check_points | int | The amount of hint points you receive per item/location check completed. ||
| games | list\[str\] | List of games present in this multiworld. |
@ -78,14 +78,14 @@ Sent to clients when they connect to an Archipelago server.
| seed_name | str | uniquely identifying name of this generation |
| time | float | Unix time stamp of "now". Send for time synchronization if wanted for things like the DeathLink Bounce. |
#### forfeit
Dictates what is allowed when it comes to a player forfeiting their run. A forfeit is an action which distributes the rest of the items in a player's run to those other players awaiting them.
#### release
Dictates what is allowed when it comes to a player releasing their run. A release is an action which distributes the rest of the items in a player's run to those other players awaiting them.
* `auto`: Distributes a player's items to other players when they complete their goal.
* `enabled`: Denotes that players may forfeit at any time in the game.
* `enabled`: Denotes that players may release at any time in the game.
* `auto-enabled`: Both of the above options together.
* `disabled`: All forfeit modes disabled.
* `goal`: Allows for manual use of forfeit command once a player completes their goal. (Disabled until goal completion)
* `disabled`: All release modes disabled.
* `goal`: Allows for manual use of release command once a player completes their goal. (Disabled until goal completion)
#### collect
Dictates what is allowed when it comes to a player collecting their run. A collect is an action which sends the rest of the items in a player's run.
@ -596,7 +596,7 @@ class Permission(enum.IntEnum):
disabled = 0b000 # 0, completely disables access
enabled = 0b001 # 1, allows manual use
goal = 0b010 # 2, allows manual use after goal completion
auto = 0b110 # 6, forces use after goal completion, only works for forfeit and collect
auto = 0b110 # 6, forces use after goal completion, only works for release and collect
auto_enabled = 0b111 # 7, forces use after goal completion, allows manual use any time
```

View File

@ -70,10 +70,9 @@ including the exclamation point.
names such as Factorio.
- `!hint <item name>` Tells you at which location in whose game your Item is. Note you need to have checked some
locations to earn a hint. You can check how many you have by just running `!hint`
- `!forfeit` If you didn't turn on auto-forfeit or if you allowed forfeiting prior to goal completion. Remember that "
forfeiting" actually means sending out your remaining items in your world.
- `!collect` Grants you all the remaining checks in your world. Can only be used after your goal is complete or when you
have forfeited.
- `!release` If you didn't turn on auto-release or if you allowed releasing prior to goal completion. Remember that "
releasing" actually means sending out your remaining items in your world.
- `!collect` Grants you all the remaining checks in your world. Typically used after goal completion.
#### Host only (on Archipelago.gg or in your server console)
@ -87,9 +86,9 @@ including the exclamation point.
- `/exit` Shutdown the server
- `/alias <player name> <alias name>` Assign a player an alias.
- `/collect <player name>` Send out any items remaining in the multiworld belonging to the given player.
- `/forfeit <player name>` Forfeits someone regardless of settings and game completion status
- `/allow_forfeit <player name>` Allows the given player to use the `!forfeit` command.
- `/forbid_forfeit <player name>` Bars the given player from using the `!forfeit` command.
- `/release <player name>` Releases someone regardless of settings and game completion status
- `/allow_release <player name>` Allows the given player to use the `!release` command.
- `/forbid_release <player name>` Bars the given player from using the `!release` command.
- `/send <player name> <item name>` Grants the given player the specified item.
- `/send_multiple <amount> <player name> <item name>` Grants the given player the stated amount of the specified item.
- `/send_location <player name> <location name>` Send out the given location for the specified player as if the player checked it

View File

@ -69,7 +69,7 @@ multiworld. The output of this process is placed in the `output` folder.
#### Changing local host settings for generation
Sometimes there are various settings that you may want to change before rolling a seed such as enabling race mode,
auto-forfeit, plando support, or setting a password.
auto-release, plando support, or setting a password.
All of these settings plus other options are able to be changed by modifying the `host.yaml` file in the Archipelago
installation folder. The settings chosen here are baked into the `.archipelago` file that gets output with the other

View File

@ -8,7 +8,7 @@ should only take a couple of minutes to read.
1. After gathering the YAML files together in one location, select all the files and compress them into a `.ZIP` file.
2. Next go to the "Generate Game" page. Generate game
page: [Archipelago Seed Generation Page](/generate). Here, you can adjust some server settings
such as forfeit rules and the cost for a player to use a hint before generation.
such as release rules and the cost for a player to use a hint before generation.
3. After adjusting the host settings to your liking click on the Upload File button and using the explorer window that
opens, navigate to the location where you zipped the player files and upload this zip. The page will generate your
game and refresh multiple times to check on completion status.

View File

@ -48,7 +48,7 @@ At minimum, every seed will require you to find the Cursed Seal and bring it bac
- `any_ending`: You must defeat the final boss.
- `true_ending`: You must first explore all 3000 rooms of the Atlas Dome and find the Agate Knife, then fight the final boss' true form.
Once the goal has been completed, you may press F to send a forfeit, sending out all of your world's remaining items to their respective players, and C to send a collect, which gathers up all of your world's items from their shuffled locations in other player's worlds. You may also press S to view your statistics, if you're a fan of numbers.
Once the goal has been completed, you may press F to send a release, sending out all of your world's remaining items to their respective players, and C to send a collect, which gathers up all of your world's items from their shuffled locations in other player's worlds. You may also press S to view your statistics, if you're a fan of numbers.
More in-depth information about the game can be found in the game's help file, accessed by pressing H while playing.

View File

@ -60,7 +60,7 @@ class ShuffleVaultBoxes(Toggle):
class ShufflePostgame(Toggle):
"""Adds locations into the pool that are guaranteed to become accessible after or at the same time as your goal.
Use this if you don't play with forfeit on victory. IMPORTANT NOTE: The possibility of your second
Use this if you don't play with release on victory. IMPORTANT NOTE: The possibility of your second
"Progressive Dots" showing up in the Caves is ignored, they will still be considered "postgame" in base settings."""
display_name = "Shuffle Postgame"