private static function loadTeam(WebSoccer $websoccer, DbConnection $db, $matchId, SimulationTeam $team) { // get players $columns['spieler_id'] = 'player_id'; $columns['name'] = 'name'; $columns['note'] = 'mark'; $columns['minuten_gespielt'] = 'minutes_played'; $columns['karte_gelb'] = 'yellow_cards'; $columns['karte_rot'] = 'red_cards'; $columns['verletzt'] = 'injured'; $columns['gesperrt'] = 'blocked'; $columns['tore'] = 'goals'; $columns['feld'] = 'field_area'; $columns['position'] = 'position'; $columns['position_main'] = 'main_position'; $columns['age'] = 'age'; $columns['w_staerke'] = 'strength'; $columns['w_technik'] = 'strength_tech'; $columns['w_kondition'] = 'strength_stamina'; $columns['w_frische'] = 'strength_freshness'; $columns['w_zufriedenheit'] = 'strength_satisfaction'; $columns['ballcontacts'] = 'ballcontacts'; $columns['wontackles'] = 'wontackles'; $columns['losttackles'] = 'losttackles'; $columns['shoots'] = 'shoots'; $columns['passes_successed'] = 'passes_successed'; $columns['passes_failed'] = 'passes_failed'; $columns['assists'] = 'assists'; $fromTable = $websoccer->getConfig('db_prefix') . '_spiel_berechnung'; $whereCondition = 'spiel_id = %d AND team_id = %d ORDER BY id ASC'; $parameters = array($matchId, $team->id); $result = $db->querySelect($columns, $fromTable, $whereCondition, $parameters); while ($playerinfo = $result->fetch_array()) { $player = new SimulationPlayer($playerinfo['player_id'], $team, $playerinfo['position'], $playerinfo['main_position'], $playerinfo['mark'], $playerinfo['age'], $playerinfo['strength'], $playerinfo['strength_tech'], $playerinfo['strength_stamina'], $playerinfo['strength_freshness'], $playerinfo['strength_satisfaction']); $player->name = $playerinfo['name']; $player->setBallContacts($playerinfo['ballcontacts']); $player->setWonTackles($playerinfo['wontackles']); $player->setLostTackles($playerinfo['losttackles']); $player->setGoals($playerinfo['goals']); $player->setShoots($playerinfo['shoots']); $player->setPassesSuccessed($playerinfo['passes_successed']); $player->setPassesFailed($playerinfo['passes_failed']); $player->setAssists($playerinfo['assists']); $player->setMinutesPlayed($playerinfo['minutes_played'], FALSE); $player->yellowCards = $playerinfo['yellow_cards']; $player->redCard = $playerinfo['red_cards']; $player->injured = $playerinfo['injured']; $player->blocked = $playerinfo['blocked']; // add player self::$_addedPlayers[$player->id] = $player; if ($playerinfo['field_area'] == 'Ausgewechselt') { $team->removedPlayers[$player->id] = $player; } else { if ($playerinfo['field_area'] == 'Ersatzbank') { $team->playersOnBench[$player->id] = $player; } else { $team->positionsAndPlayers[$player->position][] = $player; } } } $result->free(); }
/** * (non-PHPdoc) * @see ISimulationObserver::onFreeKick() */ public function onFreeKick(SimulationMatch $match, SimulationPlayer $player, SimulationPlayer $goaly, $successful) { $player->setShoots($player->getShoots() + 1); // adapt grades if ($successful) { $player->improveMark(MARK_IMPROVE_GOAL_SCORER); // do not decrease goaly's grade since it is probably not his fault, poor guy.. // update goals $player->team->setGoals($player->team->getGoals() + 1); $player->setGoals($player->getGoals() + 1); } else { $player->downgradeMark(MARK_DOWNGRADE_SHOOTFAILURE); $goaly->improveMark(MARK_IMPROVE_SHOOTFAILURE_GOALY); } }