#============================================================================== # ■ VXAce-RGSS3-16 鍛冶屋 [シーンクラス] by Claimh #============================================================================== #============================================================================== # ■ Scene_Blacksmith #============================================================================== class Scene_Blacksmith < Scene_MenuBase include Blacksmith::MesCmd #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_sys_window create_mod_window create_ctg_window @help_window = Window_Help.new @gold_window = Window_Gold.new @gold_window.x = @sys_window.width @gold_window.y = @sys_window.y @sts_window = Window_BsStatus.new(@sys_window.data) create_yn_window create_mes_window create_pt_window create_info_window create_list_window create_sublist_window # if @sys_window.fix? @sys_window.hide if @mod_window.fix? @mod_window.hide @list_window.activate @ctg_window.change(@mod_window.data) if @ctg_window.fix? # sys/mod/ctg全て固定の場合はmodを表示 @mod_window.show end else @mod_window.data = @sys_window.data @mod_window.show.activate end else @mod_window.hide end # delete_help # @equip = false @actor = nil end #-------------------------------------------------------------------------- # ● sys/mod/ctgが全て固定 #-------------------------------------------------------------------------- def all_fix? if @sys_window.fix? and @mod_window.fix? and @ctg_window.fix? @sys_window.hide @mod_window.show @ctg_window.hide end end #-------------------------------------------------------------------------- # ● ヘルプ消去 #-------------------------------------------------------------------------- def delete_help @help_window.set_text("") @pt_window.item = @sts_window.item = nil @sts_window.mode_reset(@sys_window.data) @list_window.dummy_clear end #-------------------------------------------------------------------------- # ● リストウィンドウ/サブリストウィンドウ #-------------------------------------------------------------------------- def active_list_window @sl_window.visible ? @sl_window : @list_window end #-------------------------------------------------------------------------- # ● システム選択ウィンドウ生成 #-------------------------------------------------------------------------- def create_sys_window @sys_window = Window_BsSysCmd.new @sys_window.set_handler(:ok, method(:on_sys_ok)) @sys_window.set_handler(:cancel, method(:return_scene)) end #---------------------------------------------------------------------------- # ● システム選択 OK #---------------------------------------------------------------------------- def on_sys_ok return return_scene if @sys_window.exit? @sys_window.hide unless @mod_window.fix? @mod_window.data = @sys_window.data @mod_window.show.activate @list_window.change_t(@sys_window.data * 2 + @mod_window.data) else on_mod_ok end end #-------------------------------------------------------------------------- # ● モード選択ウィンドウ生成 #-------------------------------------------------------------------------- def create_mod_window @mod_window = Window_BsModCmd.new @mod_window.set_handler(:ok, method(:on_mod_ok)) @mod_window.set_handler(:cancel, method(:on_mod_cancel)) @mod_window.hide end #---------------------------------------------------------------------------- # ● モード選択 OK #---------------------------------------------------------------------------- def on_mod_ok return return_scene if @mod_window.exit? @pt_window.create = @list_window.sys_create? @mod_window.hide @sts_window.mode_reset(@sys_window.data) @list_window.show.dummy_hide.activate.change_t(@sys_window.data * 2 + @mod_window.data) @ctg_window.show.change(@mod_window.data) all_fix? end #---------------------------------------------------------------------------- # ● モード選択 Cancel #---------------------------------------------------------------------------- def on_mod_cancel return return_scene if @sys_window.fix? @mod_window.hide @sys_window.show.activate end #-------------------------------------------------------------------------- # ● カテゴリウィンドウ生成 #-------------------------------------------------------------------------- def create_ctg_window @ctg_window = Window_BsCtg.new end #-------------------------------------------------------------------------- # ● メッセージウィンドウ生成 #-------------------------------------------------------------------------- def create_mes_window @mes_window = Window_BsCaution.new @mes_window.set_handler(:ok, method(:on_mes_ok)) @mes_window.set_handler(:cancel, method(:on_mes_ok)) end #-------------------------------------------------------------------------- # ● メッセージ OK #-------------------------------------------------------------------------- def on_mes_ok @mes_window.hide do_callback end #---------------------------------------------------------------------------- # ● 予約処理実行 #---------------------------------------------------------------------------- CB_YN = 0 CB_S_PT = 1 CB_D_PT = 2 def do_callback case @mes_window.get_callback when CB_YN @yn_window.show.activate when CB_S_PT @pt_window.activate.refresh @pt_window.index = @elist[0] when CB_D_PT @pt_window.deactivate.unselect when M_E_D, M_E_C Sound.play_equip @mes_window.set_text(@mes_window.get_callback, @actor) @actor = nil else active_list_window.activate end end #-------------------------------------------------------------------------- # ● Infoウィンドウ生成 #-------------------------------------------------------------------------- def create_info_window @info_window = Window_BsItemInfo.new @info_window.set_handler(:info, method(:on_info_ok)) @info_window.set_handler(:cancel, method(:on_info_ok)) @info_window.set_handler(:pagedown, method(:on_list_actors)) unless @pt_window.fix? @info_window.set_handler(:pageup, method(:on_list_sts)) unless @sts_window.fix? end #-------------------------------------------------------------------------- # ● Infoウィンドウ消去 #-------------------------------------------------------------------------- def on_info_ok active_list_window.activate end #-------------------------------------------------------------------------- # ● Yes/No選択ウィンドウ生成 #-------------------------------------------------------------------------- def create_yn_window @yn_window = Window_BsYesNo.new @yn_window.set_handler(:ok, method(:on_yn_ok)) @yn_window.set_handler(:cancel, method(:on_yn_cancel)) end #-------------------------------------------------------------------------- # ● Yes/No選択 OK #-------------------------------------------------------------------------- def on_yn_ok @yn_window.hide if @yn_window.index == 0 @equip = true @pt_window.index = 0 @pt_window.activate else on_yn_cancel end end #-------------------------------------------------------------------------- # ● Yes/No選択 Cancel #-------------------------------------------------------------------------- def on_yn_cancel execute @yn_window.hide @sl_window.hide @list_window.activate end #-------------------------------------------------------------------------- # ● パーティーウィンドウ生成 #-------------------------------------------------------------------------- def create_pt_window @pt_window = Window_BsActors.new @pt_window.set_handler(:ok, method(:on_pt_ok)) end #-------------------------------------------------------------------------- # ● パーティー選択 OK #-------------------------------------------------------------------------- def on_pt_ok execute(@pt_window.actor) @mes_window.set_text(M_E_C, @pt_window.actor) @mes_window.set_callback(CB_D_PT) end #-------------------------------------------------------------------------- # ● リストウィンドウ生成 #-------------------------------------------------------------------------- def create_list_window @list_window = Window_BsList.new(@sys_window.data, @mod_window.data) @list_window.pt_window = @pt_window @list_window.sts_window = @sts_window @list_window.help_window = @help_window @list_window.set_handler(:ok, method(:on_list_ok)) @list_window.set_handler(:cancel, method(:on_list_cancel)) @list_window.set_handler(:right, method(:on_list_right)) @list_window.set_handler(:left, method(:on_list_left)) @list_window.set_handler(:pagedown, method(:on_list_actors)) unless @pt_window.fix? @list_window.set_handler(:pageup, method(:on_list_sts)) unless @sts_window.fix? @list_window.set_handler(:info, method(:on_list_info)) if @info_window.enable? @list_window.set_handler(:alert, method(:on_list_alert)) end #---------------------------------------------------------------------------- # ● リスト選択 OK #---------------------------------------------------------------------------- def on_list_ok @info_window.hide if @list_window.sys_create? if @list_window.data.equippable_members.size == 0 @equip = false execute @mes_window.set_text(M_S_C, @list_window.data.obj) else @yn_window.set_text(M_S_C, @list_window.data.obj) end else @pt_window.set_exchange(false, @list_window.data.obj) @sts_window.set_exchange(false, @list_window.data.obj) @sts_window.mode_reset(0) @sl_window.startup(@list_window.data) @list_window.hide.dummy_show.dummy_refresh end end #---------------------------------------------------------------------------- # ● リスト選択 Cancel #---------------------------------------------------------------------------- def on_list_cancel @list_window.hide.dummy_show @ctg_window.hide @info_window.hide delete_help return @mod_window.show.activate unless @mod_window.fix? return @sys_window.show.activate unless @sys_window.fix? return_scene end #---------------------------------------------------------------------------- # ● リスト選択 Right #---------------------------------------------------------------------------- def on_list_right return if @ctg_window.fix? @ctg_window.shift_r @list_window.change_c(@ctg_window.index) end #---------------------------------------------------------------------------- # ● リスト選択 Left #---------------------------------------------------------------------------- def on_list_left return if @ctg_window.fix? @ctg_window.shift_l @list_window.change_c(@ctg_window.index) end #---------------------------------------------------------------------------- # ● リスト選択 アクター情報 #---------------------------------------------------------------------------- def on_list_actors @pt_window.next_page end #---------------------------------------------------------------------------- # ● リスト選択 ステータス情報 #---------------------------------------------------------------------------- def on_list_sts @sts_window.change_mode end #---------------------------------------------------------------------------- # ● リスト選択 アイテム情報 #---------------------------------------------------------------------------- def on_list_info active_list_window.deactivate @info_window.item = active_list_window.item end #---------------------------------------------------------------------------- # ● 警告メッセージ #---------------------------------------------------------------------------- def on_list_alert if @sl_window.visible unless @sl_window.data.nil? @sl_window.deactivate @mes_window.set_text(@sl_window.data.message) end else unless @list_window.data.nil? @list_window.deactivate @mes_window.set_text(@list_window.data.message) end end end #-------------------------------------------------------------------------- # ● サブリストウィンドウ生成 #-------------------------------------------------------------------------- def create_sublist_window @sl_window = Window_BsSList.new(@list_window) @sl_window.pt_window = @pt_window @sl_window.sts_window = @sts_window @sl_window.help_window = @help_window @sl_window.set_handler(:ok, method(:on_slist_ok)) @sl_window.set_handler(:cancel, method(:on_slist_cancel)) @sl_window.set_handler(:pagedown, method(:on_list_actors)) unless @pt_window.fix? @sl_window.set_handler(:pageup, method(:on_list_sts)) unless @sts_window.fix? @sl_window.set_handler(:info, method(:on_list_info)) if @info_window.enable? @sl_window.set_handler(:alert, method(:on_list_alert)) end #-------------------------------------------------------------------------- # ● サブリスト選択 Ok #-------------------------------------------------------------------------- def on_slist_ok d = @list_window.data if d.num == 0 # 所持品ない == 装備品Only # 強化したアイテムが装備できるメンバーを抽出 @elist = d.equip_actors.select { |i| $game_party.members[i].equippable?(@sl_window.data.obj) } if @elist.size > 1 # 複数人が装備可能 → 選択 @equip = true @pt_window.set_exchange(@list_window.sys_create?, d.obj) @sts_window.set_exchange(@list_window.sys_create?, d.obj) @mes_window.set_text(M_S_S, @sl_window.data.obj) @mes_window.set_callback(CB_S_PT) elsif @elist.size == 1 # 一人しか装備できない → 装備交換 @actor = $game_party.members[@elist[0]] @equip = true @mes_window.set_text(M_S_S, @sl_window.data.obj) @mes_window.set_callback(M_E_C) execute(@actor) else # 誰も装備できない → 装備を外す @actor = $game_party.members[d.equip_actors[0]] @equip = false itm = @sl_window.data.obj @actor.change_equip(itm.is_a?(RPG::Weapon) ? 0 : (itm.kind+1), 0) @mes_window.set_text(M_S_S, itm) @mes_window.set_callback(M_E_D) execute(@actor) end else # 所持品がある場合、装備中かどうかは無視 if @sl_window.data.equippable_members.size == 0 @equip = false @mes_window.set_text(M_S_S, @sl_window.data.obj) execute else @pt_window.set_exchange(@list_window.sys_create?, d.obj) @sts_window.set_exchange(@list_window.sys_create?, d.obj) @yn_window.set_text(M_S_S, @sl_window.data.obj) end end end #-------------------------------------------------------------------------- # ● サブリスト選択 Cancel #-------------------------------------------------------------------------- def on_slist_cancel @sl_window.hide @sts_window.mode_reset(@sys_window.data) @list_window.show.dummy_hide.activate @info_window.hide end #---------------------------------------------------------------------------- # ● 鍛治実行 #---------------------------------------------------------------------------- def execute(actor=nil) if @list_window.sys_create? @list_window.data.execute(@equip, actor) else @sl_window.data.execute(@equip, actor) @sts_window.mode_reset(@sys_window.data) end @equip = false @sl_window.hide.deactivate @list_window.show.dummy_hide.activate.diff_refresh @gold_window.refresh @pt_window.clear_exchange(@list_window.sys_create?, true) @sts_window.clear_exchange(@list_window.sys_create?, true) end end