class Scene_Shop < Scene_MenuBase
def create_command_window
@command_window = Window_ShopCommand.new(@gold_window.x, @purchase_only)
@command_window.viewport = @viewport
@command_window.y = @help_window.height
@command_window.set_handler(:buy, method(:command_buy))
@command_window.set_handler(:sell, method(:on_category_ok))
@command_window.set_handler(:cancel, method(:return_scene))
end
def create_sell_window
wy = @category_window.y
wh = Graphics.height - wy
@sell_window = Window_ShopSell.new(0, wy, Graphics.width, wh)
@sell_window.viewport = @viewport
@sell_window.help_window = @help_window
@sell_window.hide
@sell_window.set_handler(:ok, method(:on_sell_ok))
@sell_window.set_handler(:cancel, method(:on_category_cancel))
@category_window.item_window = @sell_window
end
def create_category_window
@category_window = Window_ItemCategory.new
@category_window.viewport = @viewport
@category_window.help_window = @help_window
@category_window.y = @dummy_window.y
@category_window.hide.deactivate
@category_window.set_handler(:ok, method(:on_category_ok))
@category_window.set_handler(:cancel, method(:on_category_cancel))
@category_window.height = 0
end
def on_category_ok
activate_sell_window
@dummy_window.hide
@sell_window.select(0)
end
end
class Window_ShopSell < Window_ItemList
def include?(item)
case @category
when :item
item.is_a?(RPG::Item) && !item.key_item? or item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor) or item.is_a?(RPG::Item) && item.key_item?
else
false
end
end
end