예제 #1
0
 /**
  * Trekk tilbake pokerrunde
  */
 protected function pullback()
 {
     // oppdater pokkerunden
     $a = \Kofradia\DB::get()->exec("\n\t\t\tUPDATE poker\n\t\t\tSET poker_state = " . self::STATE_TIMEOUT . "\n\t\t\tWHERE poker_id = {$this->id} AND poker_state IN (" . self::STATE_BEGIN . "," . self::STATE_FREE . ")");
     if ($a > 0) {
         poker_round::update_cache();
         // gi tilbake pengene
         $up = player::get_loaded($this->data['poker_starter_up_id']);
         if ($up) {
             $up->data['up_cash'] = bcadd($up->data['up_cash'], $this->data['poker_cash']);
         }
         \Kofradia\DB::get()->exec("UPDATE users_players SET up_cash = up_cash + {$this->data['poker_cash']} WHERE up_id = {$this->data['poker_starter_up_id']}");
         $this->data['poker_state'] = self::STATE_TIMEOUT;
         return true;
     }
     return false;
 }