} } else { $shop_array[$shop_selling . '_sold'] = array(); } if (is_array($shop_buying)) { foreach ($shop_buying as $token) { $shop_array[$token . '_bought'] = array(); } } else { $shop_array[$shop_buying . '_bought'] = array(); } $this_battle_shops[$shop_token] = $shop_array; } else { $shop_array = $this_battle_shops[$shop_token]; $temp_experience = !empty($shop_array['shop_experience']) ? $shop_array['shop_experience'] : 1; $temp_level = rpg_prototype::calculate_level_by_experience($temp_experience); $temp_level = floor($temp_level); if ($temp_level > 100) { $temp_level = 100; } $shop_array['shop_level'] = $temp_level; $this_battle_shops[$shop_token] = $shop_array; } // Either way, update this shop's level from the session $this_shop_index[$shop_token]['shop_level'] = $this_battle_shops[$shop_token]['shop_level']; } else { // Remove this shop from the index to prevent errors unset($this_shop_index[$shop_token]); // Update this shop's level in the index //$this_shop_index[$shop_token]['shop_level'] = 0; }