本帖最后由 魔法丶小肉包 于 2017-5-12 22:01 编辑
作为插件脚本使用,在商店里多了三个卖出全部选项(物品,武器,防具)
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(:command_sell)) @command_window.set_handler(:sellalli, method(:command_sellalli)) @command_window.set_handler(:sellallw, method(:command_sellallw)) @command_window.set_handler(:sellalla, method(:command_sellalla)) @command_window.set_handler(:cancel, method(:return_scene)) end def command_sellalli for item in $game_party.items $game_party.gain_gold($game_party.item_number(item) * (item.price / 2)) $game_party.lose_item(item, $game_party.item_number(item)) end @gold_window.refresh @status_window.refresh @command_window.activate end def command_sellallw for item in $game_party.weapons $game_party.gain_gold($game_party.item_number(item) * (item.price / 2)) $game_party.lose_item(item, $game_party.item_number(item)) end @gold_window.refresh @status_window.refresh @command_window.activate end def command_sellalla for item in $game_party.armors $game_party.gain_gold($game_party.item_number(item) * (item.price / 2)) $game_party.lose_item(item, $game_party.item_number(item)) end @gold_window.refresh @status_window.refresh @command_window.activate end end class Window_ShopCommand < Window_HorzCommand def col_max return 6 end def make_command_list add_command(Vocab::ShopBuy, :buy) add_command(Vocab::ShopSell, :sell, !@purchase_only) add_command("全部物品", :sellalli, !@purchase_only) add_command("全部武器", :sellallw, !@purchase_only) add_command("全部防具", :sellalla, !@purchase_only) add_command(Vocab::ShopCancel, :cancel) end end
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(:command_sell))
@command_window.set_handler(:sellalli, method(:command_sellalli))
@command_window.set_handler(:sellallw, method(:command_sellallw))
@command_window.set_handler(:sellalla, method(:command_sellalla))
@command_window.set_handler(:cancel, method(:return_scene))
end
def command_sellalli
for item in $game_party.items
$game_party.gain_gold($game_party.item_number(item) * (item.price / 2))
$game_party.lose_item(item, $game_party.item_number(item))
end
@gold_window.refresh
@status_window.refresh
@command_window.activate
end
def command_sellallw
for item in $game_party.weapons
$game_party.gain_gold($game_party.item_number(item) * (item.price / 2))
$game_party.lose_item(item, $game_party.item_number(item))
end
@gold_window.refresh
@status_window.refresh
@command_window.activate
end
def command_sellalla
for item in $game_party.armors
$game_party.gain_gold($game_party.item_number(item) * (item.price / 2))
$game_party.lose_item(item, $game_party.item_number(item))
end
@gold_window.refresh
@status_window.refresh
@command_window.activate
end
end
class Window_ShopCommand < Window_HorzCommand
def col_max
return 6
end
def make_command_list
add_command(Vocab::ShopBuy, :buy)
add_command(Vocab::ShopSell, :sell, !@purchase_only)
add_command("全部物品", :sellalli, !@purchase_only)
add_command("全部武器", :sellallw, !@purchase_only)
add_command("全部防具", :sellalla, !@purchase_only)
add_command(Vocab::ShopCancel, :cancel)
end
end
|