# encoding: UTF-8 #=============================================================================== # Job/Race Info+ # # Adds two new pages to the Library, which allow one to view the full learnsets # for any jobs and races the player has unlocked. # # Plug-in by steveju # Fixed by JoSmiHnTh #=============================================================================== module NWConst::Config CONTENTS.insert(-3, {:key => :mod_library_traits, :name => "Expanded Library", :sub => true, :help => "[Mod]Enable/Disable additional Character/Job/Race pages.\r\n←/→ Select"}) DATA[:mod_library_traits] = [0, 1] DATA_TEXT[:mod_library_traits] = {0 => {:name => "Off", :help => "Disable expanded library features."}, 1 => {:name => "On", :help => "Enable expanded library features."}} DEFAULT[:mod_library_traits] = 0 end module NWConst::Library INDEX_STRING[:lib_class_mod] = "Job Info+" INDEX_STRING[:lib_tribe_mod] = "Race Info+" end class Window_Library_MainCommand < Window_Command def make_command_list case @category when 1 make_actor_main_command make_return_command when 2 make_enemy_main_command make_return_command when 3 make_weapon_main_command make_return_command when 4 make_armor_main_command make_return_command when 5 make_accessory_main_command make_return_command when 6 make_item_main_command make_return_command when 7 make_record_main_command make_return_command when 8 make_medal_main_command make_return_command else make_record_index_command make_medal_index_command make_actor_index_command make_enemy_index_command make_weapon_index_command make_armor_index_command make_accessory_index_command make_item_index_command make_class_index_command make_tribe_index_command make_class_mod_index_command if $game_system.conf[:mod_library_traits] == 1 make_tribe_mod_index_command if $game_system.conf[:mod_library_traits] == 1 end make_close_command end def make_class_mod_index_command enable = !$game_party.temp_actors_use? add_command(INDEX_STRING[:lib_class_mod], :lib_class_mod, enable, [11, 110000]) end def make_tribe_mod_index_command enable = !$game_party.temp_actors_use? add_command(INDEX_STRING[:lib_tribe_mod], :lib_tribe_mod, enable, [12, 120000]) end end class Scene_Library < Scene_MenuBase def create_left_column_window @main_command_window = Window_Library_MainCommand.new @main_command_window.set_handler(:lib_record, method(:on_record_index)) @main_command_window.set_handler(:lib_medal, method(:on_medal_index)) @main_command_window.set_handler(:lib_actor, method(:on_actor_index)) @main_command_window.set_handler(:lib_enemy, method(:on_enemy_index)) @main_command_window.set_handler(:lib_weapon, method(:on_weapon_index)) @main_command_window.set_handler(:lib_armor, method(:on_armor_index)) @main_command_window.set_handler(:lib_accessory, method(:on_accessory_index)) @main_command_window.set_handler(:lib_item, method(:on_item_index)) @main_command_window.set_handler(:lib_class, method(:on_class_index)) @main_command_window.set_handler(:lib_tribe, method(:on_tribe_index)) @main_command_window.set_handler(:lib_class_mod, method(:on_class_mod_index)) if $game_system.conf[:mod_library_traits] == 1 @main_command_window.set_handler(:lib_tribe_mod, method(:on_tribe_mod_index)) if $game_system.conf[:mod_library_traits] == 1 @main_command_window.set_handler(:lib_return, method(:return_index)) @main_command_window.set_handler(:lib_close, method(:return_scene)) @main_command_window.set_handler(:cancel, method(:on_command_cancel)) @main_command_window.set_handler(:input_right, method(:on_next_page)) @main_command_window.set_handler(:input_left, method(:on_previous_page)) @main_command_window.set_handler(:scrolldown, method(:on_scroll_down)) @main_command_window.set_handler(:scrollup, method(:on_scroll_up)) @main_command_window.index_window = @header_nav_window @main_command_window.contents_window = @main_contents_window @main_command_window.help_window = @footer_help_window end def on_class_mod_index $game_temp.lib_class_type_id = 2 SceneManager.call(Scene_JobShow) end def on_tribe_mod_index $game_temp.lib_class_type_id = 3 SceneManager.call(Scene_JobShow) end end class Scene_JobShow < Scene_JobChange include ShowKey_HelpWindow #-------------------------------------------------------------------------- # ● 全ウィンドウの作成 #-------------------------------------------------------------------------- def create_all_window @change_class_type_id = $game_temp.lib_class_type_id @change_class_type_id -= 2 if @change_class_type_id > 1 create_help_window create_class_status_window create_class_name_window create_class_type_window create_result_popup_window class_type_name = ["Job", "Race", "Job", "Race"].at($game_temp.lib_class_type_id) unless $game_temp.lib_class_type_id > 1 @help_window.text = "#{class_type_name} Info (Unlock Percentage Not Available)" else @help_window.text = "#{class_type_name} Learnable Skills/Abilities" end @class_status_window.show.activate @class_status_window.actor_id = @change_class_actor_id @class_status_window.original_class_id = $game_temp.lib_class_type_id @class_type_window.show.activate @class_type_window.class_type_id = @change_class_type_id @class_type_window.refresh @class_type_window.select(0) @class_name_window.show.activate @class_name_window.class_type_id = @change_class_type_id @class_name_window.actor_id = @change_class_actor_id @class_name_window.refresh @class_name_window.select(0) end alias jobraceinfo_create_class_name_window create_class_name_window def create_class_name_window jobraceinfo_create_class_name_window @class_name_window.set_handler(:ok, @class_status_window.method(:next_page)) end alias jobraceinfo_show_key_text show_key_text def show_key_text return "#{Vocab.key_c}:Next Page" if $game_temp.lib_class_type_id > 1 return jobraceinfo_show_key_text end end class Foo::JobChange::Window_ClassStatus < Window_Base attr_writer :original_class_id def initialize super(160, fitting_height(1) * 2, Graphics.width - 160, Graphics.height - fitting_height(1) * 2) @actor_id = -1 @class_id = -1 @original_class_id = -1 @page = 1 @max_page = 2 hide.deactivate end def next_page @page += 1 @page = 1 if @page > @max_page refresh end def draw_status y = 0 unless @original_class_id > 1 y = draw_job_name(y) y = draw_horz_line(y) end y = draw_job_desc(y, 0) unless @original_class_id > 1 y = draw_horz_line(y) y = draw_job_param(y) y = draw_horz_line(y) y = draw_job_desc(y, 1) end end def draw_text_job_desc(rect, text) reset_font_settings text = convert_escape_characters(text) pos = {:x => rect.x, :y => rect.y, :new_x => rect.x, :height => line_height} contents.font.size -= 6 process_character(text.slice!(0, 1), text, pos) until text.empty? end def draw_job_desc(y, num) unless @original_class_id > 1 desc_text = NWConst::JobChange::JOB_DESC_TEXT[@class_id] desc = desc_text[num] if desc_text else desc = [] temp_desc = [] items_per_page = 10 $data_classes[@class_id].learnings.each_with_index do |learn, i| next unless learn.level <= (@page * items_per_page) && learn.level > ((@page - 1) * items_per_page) if !temp_desc[learn.level] temp_desc[learn.level] = [] end if $data_skills[learn.skill_id].name.include?("***ダミー".force_encoding('UTF-8').encode) temp_desc[learn.level].push("(SEALED)") else temp_desc[learn.level].push("\\*\\i[#{$data_skills[learn.skill_id].icon_index}]#{$data_skills[learn.skill_id].name}") end end temp_desc.each_with_index {|d,i| desc.push("Lv.#{i} #{d.join(",")}") unless d == nil || d.empty?} desc.push("None ( Page #{@page} / #{@max_page} )") if desc.empty? desc = [desc.join("\n")] end return y + line_height unless desc rect = standard_rect(y, desc.size) r = Rect.new(rect.x, rect.y, rect.width, line_height) desc.each do |text| draw_text_job_desc(r, text) r.y += line_height end return rect.y + rect.height end end class Foo::JobChange::LibWindow_ClassName < Foo::JobChange::Window_ClassName def process_ok if $game_temp.lib_class_type_id > 1 && current_item_enabled? Input.update call_ok_handler end end end