Temporary reattributeColorsBasedOnPreferences for the Studio
Posted: 03 December 2015, 11:20
If you want to test for the use of reattributeColorsBasedOnPreferences() in the Studio, since the function isn't available on the Studio yet (and I'm afraid won't be for quite some time).
Code: Select all
//Compensate the absence of reattributeColorsBasedOnPreferences
public function __call($method, $args) {
if ($method == 'reattributeColorsBasedOnPreferences' && !method_exists($this, 'reattributeColorsBasedOnPreferences')) {
list($players, $colors) = $args;
foreach ($players as $playerId => $player) {
//Set player colors from last color to the first so it gets a chance to mess up with the default first to last color assignment
self::DbQuery("UPDATE player SET player_color='" . array_pop($colors) . "' WHERE player_id='$playerId'");
}
}
}