-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for "freestyle" in multiplayer #11760
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5bacdc6
Add `beatmapset_id` to multiplayer playlist items
smoogipoo 68c2605
Allow multiplayer scores with arbitrary beatmap/ruleset combinations
smoogipoo fa57845
Modify to boolean 'freestyle' parameter instead
smoogipoo 4699f50
Require strict types + add license header
smoogipoo 2ecb1f0
Fix inspection
smoogipoo 487a3fc
Merge remote-tracking branch 'origin/master' into HEAD
nanaya 87db8f4
Readd beatmap_id validation
nanaya 0d393a8
Disallow mod on freestyle
nanaya adecc03
Lint fix
nanaya ac1b77b
No smarts allowed
nanaya 2b05d09
Fix incorrect check and short circuit if passed
nanaya 6f053b3
Wrong id
nanaya 5753857
Merge branch 'master' into multiplayer-free-style
notbakaneko 72baade
Correctly cast the field
nanaya 6e84fed
Redate migration
nanaya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
* @property int $owner_id | ||
* @property int|null $playlist_order | ||
* @property json|null $required_mods | ||
* @property bool $freestyle | ||
* @property Room $room | ||
* @property int $room_id | ||
* @property int|null $ruleset_id | ||
|
@@ -64,6 +65,7 @@ public static function fromJsonParams(User $owner, $json) | |
$obj->$field = $value; | ||
} | ||
|
||
$obj->freestyle = get_bool($json['freestyle'] ?? false); | ||
$obj->max_attempts = get_int($json['max_attempts'] ?? null); | ||
|
||
$modsHelper = app('mods'); | ||
|
@@ -169,6 +171,10 @@ private function assertValidRuleset() | |
|
||
private function assertValidMods() | ||
{ | ||
if ($this->freestyle && (count($this->allowed_mods) === 0 || count($this->required_mods) === 0)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't these be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes indeed 🤨 |
||
throw new InvariantException("mod isn't allowed in freestyle"); | ||
} | ||
|
||
$allowedModIds = array_column($this->allowed_mods, 'acronym'); | ||
$requiredModIds = array_column($this->required_mods, 'acronym'); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
database/migrations/2024_12_10_035240_add_freestyle_to_multiplayer_playlist_items.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('multiplayer_playlist_items', function (Blueprint $table) { | ||
$table->boolean('freestyle')->after('required_mods')->default(false); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::table('multiplayer_playlist_items', function (Blueprint $table) { | ||
$table->dropColumn('freestyle'); | ||
}); | ||
} | ||
}; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to be added into
$casts
as well.(unrelated to this, why is the
mods
cast of thisobject
butDailyChallengeQueueItem
array
🤔 )