=begin FSM様「FSG_Storage」対応のスクリプト。手持ちの最大数を越えるアイテムを入手した際 超過分を自動で倉庫に預けます。 勿論FSG_Possessionも対応。 作成:faida このスクリプトはFSM様の利用規約に従って使用してください。 =end #============================================================================== # ■ Game_Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ★ アイテムの増加 (減少) #-------------------------------------------------------------------------- alias _FSG_Storage_gain_item gain_item def gain_item(item, n, include_equip = false) number = item_number(item) i = 0 while n + number > 99 value = [FSG::Storage.max_number(@item,i) - FSG::Storage.number(@item,i)] value.push(n + number - 99); value = value.min FSG::Storage.gain_item(@item, value, i); n -= value; i += 1 end _FSG_Storage_gain_item(item, n, include_equip) end end #============================================================================== # ■ Scene_Shop #============================================================================== class Scene_Shop < Scene_Base #-------------------------------------------------------------------------- # ● 購入アイテム選択の更新 #-------------------------------------------------------------------------- def update_buy_selection @status_window.item = @buy_window.item if Input.trigger?(Input::B) Sound.play_cancel @command_window.active = true @dummy_window.visible = true @buy_window.active = false @buy_window.visible = false @status_window.visible = false @status_window.item = nil @help_window.set_text("") return end if Input.trigger?(Input::C) @item = @buy_window.item limit = 99 - $game_party.item_number(@item) # ☆ for i in 0...$game_party.fsg_storage.size # ☆ limit += FSG::Storage.max_number(@item,i) - FSG::Storage.number(@item,i) end if @item == nil or @item.price > $game_party.gold or limit == 0 # ☆ Sound.play_buzzer else Sound.play_decision max = @item.price == 0 ? 99 : $game_party.gold / @item.price max = [max, limit].min # ☆ @buy_window.active = false @buy_window.visible = false @number_window.set(@item, max, @item.price) @number_window.active = true @number_window.visible = true end end end end module FSG module Possession PLUGIN = {} unless defined?(PLUGIN) end end if FSG::RGSS["Possession"] #============================================================================== # ■ Game_Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ★ アイテムの増加 (減少) #-------------------------------------------------------------------------- def gain_item(item, n, include_equip = false) number = item_number(item) limit = FSG::Possession.max_number(item) if n > 0 and FSG::Possession::INCLUDE_EQUIP limit -= FSG::Possession.equip_number(item) end i = 0 while n + number > limit value = [FSG::Storage.max_number(item,i) - FSG::Storage.number(item,i)] value.push(number + n - limit); value = value.min FSG::Storage.gain_item(item, value, i); n -= value; i += 1 end _FSG_Storage_gain_item(item, n, include_equip) end end end # <= if FSG::RGSS["Possession"] if FSG::Possession::PLUGIN["Shop"] #============================================================================== # ■ Scene_Shop #============================================================================== class Scene_Shop < Scene_Base #-------------------------------------------------------------------------- # ○ 購入アイテム選択の更新 #-------------------------------------------------------------------------- def update_buy_selection @status_window.item = @buy_window.item if Input.trigger?(Input::B) Sound.play_cancel @command_window.active = true @dummy_window.visible = true @buy_window.active = false @buy_window.visible = false @status_window.visible = false @status_window.item = nil @help_window.set_text("") return end if Input.trigger?(Input::C) @item = @buy_window.item limit = FSG::Possession.boughtable_number(@item) for i in 0...$game_party.fsg_storage.size # ☆ limit += FSG::Storage.max_number(@item,i) - FSG::Storage.number(@item,i) end if @item == nil or limit <= 0 Sound.play_buzzer else Sound.play_decision @buy_window.active = false @buy_window.visible = false @number_window.set(@item, limit, @item.price) @number_window.active = true @number_window.visible = true end end end end end # <= if FSG::Possession::PLUGINPLUGIN["Shop"]