/** * Handles the Defused_The_Bomb event. * * @return void */ public function handleDefusedTheBomb() { ++$this->player->defuses; $this->player->save(); $re = new RoundEvent(); $re->map_id = $this->map->id; $re->current_round = $this->map->current_round; $re->type = 'bomb_defused'; $re->data = ['defuser' => $this->player->id]; $re->save(); }
/** * Handles the event. * * @param array $matches * * @return void */ public function handle($matches) { list(, $username, , $steamid) = $matches; $player = Player::firstOrNew(['map_id' => $this->map->id, 'steam_id' => $steamid]); $player->username = $username; $player->save(); }
/** * Handles the event. * * @param array $matches * * @return void */ public function handle($matches) { $attacker = Player::where('steam_id', $matches[3])->where('map_id', $this->map->id)->first(); $attacked = Player::where('steam_id', $matches[7])->where('map_id', $this->map->id)->first(); if (is_null($attacker) || is_null($attacked)) { return; } ++$attacker->assists; $attacker->save(); $re = new RoundEvent(); $re->map_id = $this->map->id; $re->current_round = $this->map->score_a + $this->map->score_b + 1; $re->type = 'assisted_in_killing'; $re->data = ['attacker' => $attacker->id, 'attacked' => $attacked->id]; $re->save(); }
/** * Handles the event. * * @param array $matches * * @return void */ public function handle($matches) { $attacker = Player::where('steam_id', $matches[3])->where('map_id', $this->map->id)->first(); $attacked = Player::where('steam_id', $matches[10])->where('map_id', $this->map->id)->first(); if (is_null($attacker) || is_null($attacked)) { return; } ++$attacker->kills; ++$attacked->deaths; $re = new RoundEvent(); $re->map_id = $this->map->id; $re->current_round = $this->map->score_a + $this->map->score_b + 1; $re->type = 'kill'; $re->data = ['attacker' => $attacker->id, 'attacker_location' => $matches[5] . ' ' . $matches[6] . ' ' . $matches[7], 'attacked' => $attacked->id, 'attacked_location' => $matches[12] . ' ' . $matches[13] . ' ' . $matches[14], 'weapon' => $matches[15]]; $re->save(); if (Str::contains($matches[16], 'headshot')) { ++$attacker->headshots; } $attacker->save(); $attacked->save(); }
/** * Handles the event. * * @param array $matches * * @return void */ public function handle($matches) { $player = Player::firstOrNew(['map_id' => $this->map->id, 'steam_id' => $matches[3]]); $player->username = $matches[1]; $player->save(); }