#============================================================================== # ■ RGSS3 ショップ装備品比較 Ver1.00 by 星潟 #------------------------------------------------------------------------------ # 販売されている装備品と現在の装備品の性能を装備画面で比較する為の # 特殊なコマンドをショップ側に用意します。 # 装備画面で確認する事が出来る為 # 装備画面スクリプトで確認できるステータス表示内容が # 詳細であればあるほど詳しい比較が可能になります。 #============================================================================== module ShopEquipTest #ショップにおける装備比較コマンドの名前を指定。 Command1 = "装備比較" #装備比較用装備シーンにおける装備比較コマンドの名前を指定。 Command2 = "比較" #装備比較用装備シーンにおける装備無し状態での装備比較コマンドの名前を指定。 Command3 = "基礎" #前のアクター、後のアクターへの遷移用コマンドの有無を指定。 #trueで有り、falseで無し。 PrevNext = false #前のアクター、後のアクターへの遷移用コマンドの名前を指定。 Commands = ["前へ","後へ"] #装備比較時に最初にどのアクターを開くかを指定。 #trueでメニューアクター(メニュー画面等で最後に選択したアクター)。 #falseでパーティの先頭アクター(この場合、このアクターがメニューアクターとなる)。 MenuActor = false end class Game_Party < Game_Unit attr_accessor :equip_test #-------------------------------------------------------------------------- # 全てのアイテムオブジェクトの配列取得 #-------------------------------------------------------------------------- alias all_items_equip_test all_items def all_items $game_party.equip_test ? $game_party.equip_test[:goods] : all_items_equip_test end #-------------------------------------------------------------------------- # メニューアクターIDを0にする #-------------------------------------------------------------------------- def menu_actor_id_zero @menu_actor_id = 0 end end class Scene_Shop < Scene_MenuBase #-------------------------------------------------------------------------- # 開始処理 #-------------------------------------------------------------------------- alias start_equip_test start def start $game_party.equip_test = nil start_equip_test end #-------------------------------------------------------------------------- # コマンドウィンドウの作成 #-------------------------------------------------------------------------- alias create_command_window_equip_test create_command_window def create_command_window create_command_window_equip_test @command_window.set_handler(:equip_test,method(:command_equip_test)) @command_window.equip_test_cancel_last end #-------------------------------------------------------------------------- # 装備比較 #-------------------------------------------------------------------------- def command_equip_test $game_party.equip_test = {} a = [] @goods.each {|g| case g[0] when 0;a.push($data_items[g[1]]) when 1;a.push($data_weapons[g[1]]) when 2;a.push($data_armors[g[1]]) end} $game_party.equip_test[:goods] = a $game_party.equip_test[:purchase_only] = @purchase_only $game_party.menu_actor_id_zero if !ShopEquipTest::MenuActor SceneManager.call(Scene_Equip) end end class Scene_Equip #-------------------------------------------------------------------------- # アイテムウィンドウの作成 #-------------------------------------------------------------------------- alias create_item_window_equip_test create_item_window def create_item_window create_item_window_equip_test @item_window.equip_test_erase_ok if $game_party.equip_test end #-------------------------------------------------------------------------- # コマンドウィンドウの作成 #-------------------------------------------------------------------------- alias create_command_window_equip_test create_command_window def create_command_window create_command_window_equip_test if $game_party.equip_test @command_window.set_handler(:equip_no_equip_test,method(:equip_no_equip_test)) @command_window.set_handler(:prev_actor,method(:prev_actor)) @command_window.set_handler(:next_actor,method(:next_actor)) end end #-------------------------------------------------------------------------- # 装備が無い基礎状態での比較 #-------------------------------------------------------------------------- def equip_no_equip_test @actor = Marshal.load(Marshal.dump($game_actors[@actor.id])) @actor.init_equips([]) @slot_window.actor = @actor @status_window.actor = @actor @item_window.actor = @actor command_equip end #-------------------------------------------------------------------------- # スロット[キャンセル] #-------------------------------------------------------------------------- alias on_slot_cancel_window_equip_test on_slot_cancel def on_slot_cancel if $game_party.equip_test @actor = $game_actors[@actor.id] @slot_window.actor = @actor @status_window.actor = @actor @item_window.actor = @actor end on_slot_cancel_window_equip_test end end class Window_EquipSlot < Window_Selectable #-------------------------------------------------------------------------- # 装備解除のハンドリング処理 #-------------------------------------------------------------------------- if method_defined?(:process_release_equip) alias process_release_equip_equip_test process_release_equip def process_release_equip if $game_party.equip_test Sound.play_buzzer activate return end process_release_equip_equip_test end end #-------------------------------------------------------------------------- # 最強装備のハンドリング処理 #-------------------------------------------------------------------------- if method_defined?(:process_optimize) alias process_optimize_equip_test process_optimize def process_optimize if $game_party.equip_test Sound.play_buzzer activate return end process_optimize_equip_test end end #-------------------------------------------------------------------------- # 全装備解除のハンドリング処理 #-------------------------------------------------------------------------- if method_defined?(:process_all_release) alias process_all_release_equip_test process_all_release def process_all_release if $game_party.equip_test Sound.play_buzzer activate return end process_all_release_equip_test end end end class Window_ShopCommand < Window_HorzCommand #-------------------------------------------------------------------------- # コマンドリストの作成 #-------------------------------------------------------------------------- alias make_command_list_equip_test make_command_list def make_command_list make_command_list_equip_test add_command(ShopEquipTest::Command1, :equip_test) ai = -1 @list.each_with_index {|h,i| ai = i if h[:symbol] == :cancel} if ai >= 0 h = @list[ai] @list.delete_at(ai) @list.push(h) end end #-------------------------------------------------------------------------- # 桁数の取得 #-------------------------------------------------------------------------- alias col_max_equip_test col_max def col_max col_max_equip_test + 1 end #-------------------------------------------------------------------------- # やめるコマンドを最後に #-------------------------------------------------------------------------- def equip_test_cancel_last if @handler.include?(:cancel) h = {} c = @handler[:cancel] @handler.delete(:cancel) @handler.each {|k,v| h[k] = v} @handler = h @handler[:cancel] = c end end end class Window_EquipItem < Window_ItemList #-------------------------------------------------------------------------- # OKハンドラを消去 #-------------------------------------------------------------------------- def equip_test_erase_ok @handler.delete(:ok) end end class Window_EquipCommand < Window_HorzCommand #-------------------------------------------------------------------------- # コマンドリストの作成 #-------------------------------------------------------------------------- alias make_command_list_equip_test make_command_list def make_command_list if $game_party.equip_test add_command(ShopEquipTest::Commands[0], :prev_actor) if ShopEquipTest::PrevNext add_command(ShopEquipTest::Command2, :equip) add_command(ShopEquipTest::Command3, :equip_no_equip_test) add_command(ShopEquipTest::Commands[1], :next_actor) if ShopEquipTest::PrevNext else make_command_list_equip_test end end #-------------------------------------------------------------------------- # 桁数の取得 #-------------------------------------------------------------------------- alias col_max_equip_test col_max def col_max $game_party.equip_test ? 2 + (ShopEquipTest::PrevNext ? 2 : 0) : col_max_equip_test end end