// Collect the preset battle info from the index $this_preset_battle = rpg_battle::get_index_info($this_battleinfo['battle_token']); if (!empty($this_preset_battle)) { $this_battleinfo = array_replace($this_preset_battle, $this_battleinfo); } // Define the battle object using the loaded battle data and update session $this_battle = new rpg_battle($this_battleinfo); // Start the battle turn off at zero $this_battle->set_counter('battle_turn', 0); // Collect preset field info from the battle $this_preset_field = $this_battle->get_field_info(); if (!empty($this_preset_field)) { $this_fieldinfo = array_replace($this_preset_field, $this_fieldinfo); } // Collect this player's preset info from the battle $this_preset_player = $this_battle->get_this_player(); if (!empty($this_preset_player)) { $this_playerinfo = array_merge($this_preset_player, $this_playerinfo); } // Collect this player's preset robots from the battle $this_preset_robots = array(); if (isset($this_playerinfo['player_robots'])) { $this_preset_robots = $this_playerinfo['player_robots']; } $this_playerinfo['player_robots'] = array(); // Update this player's name if this is a player battle if ($this_battle->get_flag('player_battle')) { $temp_name = !empty($this_userinfo['user_name_public']) ? $this_userinfo['user_name_public'] : $this_userinfo['user_name']; $this_playerinfo['player_name'] = $temp_name; } // Update this player's items if they exist in the session