| 
 
| 赞 | 15 |  
| VIP | 320 |  
| 好人卡 | 64 |  
| 积分 | 3 |  
| 经验 | 112963 |  
| 最后登录 | 2022-8-25 |  
| 在线时间 | 2355 小时 |  
 Lv2.观梦者 (暗夜天使) 
	梦石0 星屑266 在线时间2355 小时注册时间2009-3-13帖子2309 
 | 
| 本帖最后由 Sion 于 2013-6-10 18:29 编辑 
 kittyblain 发表于 2013-6-10 13:56 ![]() 呃- - 猫目前的确是这么做的,不过收购的部分是稍显麻烦的,因为如果是收复数物品(比如铁匠大叔收购所有 ...
 
 
   复制代码# 使用方法
# 在商店命令的上方加入注释
# item 1 2 3 4..... 表示只有1 2 3 4 物品可以出售
# weapon 代表武器, armor 代表防具
# 例子:
# item 1 5 10 2 4
# weapon  4, 5, 6, 7
# armor 13|14|15|16
# 中间隔开就行。
class Game_Interpreter
  
  def command_302
    return if $game_party.in_battle
    sell_lists = []
    index = @index - 1
    while @list[index].code == 108 || @list[index].code == 408
      sell_lists.push(@list[index])
      index -= 1
    end
    goods = [@params]
    while next_event_code == 605
      @index += 1
      goods.push(@list[@index].parameters)
    end
    SceneManager.call(Scene_Shop)
    SceneManager.scene.prepare(goods, @params[4], sell_lists)
    Fiber.yield
  end
end
class Scene_Shop < Scene_MenuBase
  
  def prepare(goods, purchase_only, lists)
    @goods = goods
    @purchase_only = purchase_only
    setup_sell(lists)
  end
  def setup_sell(lists)
    @sell_list = {}
    lists.each {|list| setup_sell_list(list.parameters[0])}
  end
  def setup_sell_list(texts)
    if texts.include?('item')
      @sell_list[:item] = texts.scan(/\d+/)
    elsif texts.include?('weapon')
      @sell_list[:weapon] = texts.scan(/\d+/)
    elsif texts.include?('armor')
      @sell_list[:armor] = texts.scan(/\d+/)
    end
  end
  
  def create_sell_window
    wy = @category_window.y + @category_window.height
    wh = Graphics.height - wy
    @sell_window = Window_ShopSell.new(0, wy, Graphics.width, wh, @sell_list)
    @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_sell_cancel))
    @category_window.item_window = @sell_window
  end
end
class Window_ShopSell < Window_ItemList
  def initialize(x, y, width, height, sell_list)
    super(x, y, width, height)
    @sell_list = sell_list
  end
  
  def include?(item)
    case @category
    when :item
      item.is_a?(RPG::Item) && item_list_include?(item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon) && weapon_list_include?(item)
    when :armor
      item.is_a?(RPG::Armor) && armor_list_include?(item)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  
  def item_list_include?(item)
    @sell_list[:item] ? @sell_list[:item].include?(item.id.to_s) : true
  end
  def weapon_list_include?(item)
    @sell_list[:weapon] ? @sell_list[:weapon].include?(item.id.to_s) : true
  end
  def armor_list_include?(item)
    @sell_list[:armor] ? @sell_list[:armor].include?(item.id.to_s) : true
  end
end
 | 
 评分
查看全部评分
 |