查看: 1724|回复: 1

[已经解决] 用了物品分类脚本之后无法出售的问题

[复制链接]
梦石
0
星屑
50
在线时间
395 小时
注册时间
2012-1-12
回帖
155
发表于 2015-7-9 23:13:23 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
用了这个物品分类脚本之后

[pre lang="ruby"]#==============================================================================
#  功能:[RMVA]增加物品栏类别
#  作者:ScottyFan
#  版本:v1.0 2013.8.8
#  使用说明:
#         在数据库-物品(包括装备)-备注 里写入 @itype[位置编号]
#         新的物品分类编号是从 1 开始。比如 @itype[1]或者@itype[2]
#==============================================================================
module SFS
  CATEGORY = [            #格式["显示名称", :标识],  标识随便写,不重复即可
    ["",     :default],   #注意,不要更改此行
    ["恢复", :Recovery],  #此处为编号1
    ["辅助", :Aid],
    ["材料", :Material],
    ["宝石", :Gem],
    ]
end

class RPG::BaseItem
  attr_reader   :category_id
  def category_id
    return if self.is_a?(RPG::Skill)
    if @category_id.nil?
      /@itype\[(.+?)\]/ =~ @note
      @category_id = $1.to_i
    end
    @category_id
  end
end


class Window_ItemList
  #--------------------------------------------------------------------------
  # ● 查询列表中是否含有此物品
  #--------------------------------------------------------------------------
  def include?(item)
    if item && item.category_id > 0 #如果是特殊类别
      return @category == SFS::CATEGORY[item.category_id][1]
    end
    case @category   
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
end

class Window_ItemCategoryNew < Window_Command
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_reader   :item_window
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    @item_window.category = current_symbol if @item_window
  end
  #--------------------------------------------------------------------------
  # ● 生成指令列表
  #--------------------------------------------------------------------------
  def make_command_list
    SFS::CATEGORY.each do |itype|
      next if itype[1] == :default
      add_command(itype[0],  itype[1])
    end
    add_command("其它",     :item)
    add_command(Vocab::weapon,   :weapon)
    add_command(Vocab::armor,    :armor)
    add_command(Vocab::key_item, :key_item)
  end
  #--------------------------------------------------------------------------
  # ● 设置物品窗口
  #--------------------------------------------------------------------------
  def item_window=(item_window)
    @item_window = item_window
    update
  end
end

class Scene_Item < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● 生成分类窗口
  #--------------------------------------------------------------------------
  def create_category_window
    @category_window = Window_ItemCategoryNew.new(0, @help_window.height)
    @category_window.viewport = @viewport
    @category_window.help_window = @help_window
    @category_window.height = Graphics.height - @help_window.height
    @category_window.set_handler(:ok,     method(:on_category_ok))
    @category_window.set_handler(:cancel, method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # ● 生成物品窗口
  #--------------------------------------------------------------------------
  def create_item_window
    wx = @category_window.width
    wh = Graphics.height - @help_window.height
    @item_window = Window_ItemList.new(wx, @help_window.height, Graphics.width - wx, wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:on_item_cancel))
    @category_window.item_window = @item_window
  end
end
[/pre]

普通的物品就无法出售了   不知道有没有办法解决

无限の剣制

梦石
0
星屑
10450
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2015-7-9 23:33:51 | 显示全部楼层

点评

已经解决,非常感谢!  发表于 2015-7-10 15:42

评分

参与人数 1星屑 +150 收起 理由
taroxd + 150 认可答案

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部