Skip to content

Commit 4b0c2ef

Browse files
authored
Merge pull request #401 from CnCNet/develop
Develop
2 parents ff308d1 + 67bd926 commit 4b0c2ef

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

cncnet-api/app/Http/Services/QuickMatchSpawnService.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public static function createSpawnStruct($qmMatch, QmMatchPlayer $qmPlayer, $lad
3636

3737
srand($qmMatch->seed); // Seed the RNG for possibly random boolean options
3838

39+
$isObserver = $qmPlayer->is_observer == 1;
40+
$notAllowedToChat = !$qmPlayer->player->user->getIsAllowedToChat();
41+
3942
$spawnStruct["spawn"]["Settings"] = array_filter(
4043
[
4144
"UIGameMode" => $qmMap->game_mode,
@@ -52,7 +55,7 @@ public static function createSpawnStruct($qmMatch, QmMatchPlayer $qmPlayer, $lad
5255
"Color" => $qmPlayer->color,
5356
"MyIndex" => $qmPlayer->color,
5457
"IsSpectator" => "False",
55-
"DisableChat" => $qmPlayer->player->user->getIsAllowedToChat() ? "False" : "True",
58+
"DisableChat" => ($isObserver || $notAllowedToChat) ? "True" : "False",
5659
// Filter null values
5760
],
5861
function ($var)

cncnet-api/app/Models/Game.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,7 @@ public function observers()
116116

117117
public function players()
118118
{
119-
if (!$this->report)
120-
{
121-
return collect();
122-
}
123-
124-
return PlayerGameReport::where('game_report_id', $this->report->id)
119+
return $this->hasMany(PlayerGameReport::class, 'game_report_id', 'game_report_id')
125120
->where('spectator', false)
126121
->with('player');
127122
}

cncnet-api/app/Models/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public function getEffectiveUserRatingForLadder($ladderId)
431431
*/
432432
public function getLiveUserTier($history)
433433
{
434-
$userRating = $this->getOrCreateLiveUserRating();
434+
$userRating = $this->getEffectiveUserRatingForLadder($history->ladder);
435435
return UserRatingService::getTierByLadderRules($userRating->rating, $history->ladder);
436436
}
437437

0 commit comments

Comments
 (0)