public static function newAccountDrop($userID) { ActivatedMogs::activateNew(45, 5, 0, $userID); }
public function processGameOver() { //set match state, match complete, and in progress $this->in_progress = 0; $this->match_complete = 1; $this->match_state = 3; //update game count for players DB::table('User')->whereIn('id', array($this->p1_id, $this->p2_id))->increment('game_count'); //determine who wins if ($this->p1_mog_count > $this->p2_mog_count) { //player 1 wins $winner = $this->p1_id; $loser = $this->p2_id; } else { if ($this->p1_mog_count < $this->p2_mog_count) { //player 2 wins $winner = $this->p2_id; $loser = $this->p1_id; } else { //tie $winner = false; } } //update winners game count DB::table('User')->where('id', '=', $winner)->increment('keeps_wins'); DB::table('User')->where('id', '=', $winner)->increment('total_wins'); //call new mog drops for winner/loser respectively if (!$winner) { //if tie users get low common drop ActivatedMogs::activateNew(5, 0, 0, $this->p1_id); ActivatedMogs::activateNew(5, 0, 0, $this->p2_id); } else { //values for drops $commonNum = 15; $rareNum = 0; $legendaryNum = 0; //rare roll... if (rand(0, 10) > 8) { $rareNum = rand(1, 4); } //legendary roll... if (rand(0, 10) >= 9) { $legendaryNum = 1; } $commonNum -= $rareNum + $legendaryNum; ActivatedMogs::activateNew($commonNum, $rareNum, $legendaryNum, $winner); ActivatedMogs::activateNew(5, 0, 0, $loser); } //reset players mog bet status ActivatedMogs::resetBetStatus($this->p1_id); ActivatedMogs::resetBetStatus($this->p2_id); $this->save(); }