Commit 3d71cb9c authored by Jack Stupple's avatar Jack Stupple

If the language change causes a currency change then start again - otherwise...

If the language change causes a currency change then start again - otherwise you will start at like 16k p/m salary in GBP
parent 9e9d8766
......@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Api;
use App\Language;
use App\Player;
use Illuminate\Http\Request;
......@@ -70,13 +71,17 @@ class PlayerController extends Controller
$previous_character = $player->character_id;
$player->character_id = $request->input('character_id', $player->character_id);
$previous_language = Language::where('id', $player->language_id);
$player->language_id = $request->input('language_id', $player->language_id);
$new_language = Language::where('id', $player->language_id);
$player->budget_intro_completed = $budget_intro_completed;
$player->calendar_intro_completed = $calendar_intro_completed;
$player->user_agent = json_encode($request->input('user_agent', json_decode($player->user_agent)));
$player->save();
if ((!$player->character_id || $player->character_id !== $previous_character) && $player->progress !== 0) {
if ((!$player->character_id || $player->character_id !== $previous_character) && $player->progress !== 0 || $previous_language->currency_id !== $new_language->currency_id) {
// delete the history - we just switched character
$player->increment('playthrough');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment