注册会员 登录
Project1 返回首页

喵呜喵5的树洞 https://rpg.blue/?291206 [收藏] [复制] [分享] [RSS]

日志

【脚本】高价回收物品的商店

热度 14已有 2222 次阅读2014-3-20 13:18 |个人分类:脚本| 高价回收

=begin
===============================================================================
  高价回收物品的商店 By喵呜喵5
===============================================================================

【说明】

  指定的开关打开时,事件指令中的商店处理会进入特定的物品回收商店

  在物品回收商店中无法购买物品,只能贩卖物品

  物品的售价则为商店处理中设置的物品价格(而非数据库中设置的价格)

=end
$m5script ||= {}
$m5script[:M5SS20151022] = 20151022
module M5SS20151022
#==============================================================================
# 设定部分
#==============================================================================

  SWI = 1

  #这里设置一个开关ID,当开关打开时使用商店处理将进入物品回收商店

  SHOW1 = true    # true / false

  #设置为true时,在物品回收商店也能以正常价格(原价除2)贩卖没有设置价格的物品

  SHOW2 = false    # true / false

  #设置为true时,在物品回收商店中也会显示玩家不拥有但有设置价格的物品

#==============================================================================
# 设定结束
#==============================================================================
class Sell < Window_ShopSell
  attr_writer :shop_goods
  def initialize *args
    super *args
    @shop_goods = []
  end
  def make_item_list
    @data = []
    @price = {}
    @shop_goods.each do |goods|
      item = ( case goods[0]
               when 0 then $data_items
               when 1 then $data_weapons
               when 2 then $data_armors
               end )[ goods[1] ]
      if item
        next unless include?(item)
        @data << item
        @price[item] = goods[2] == 0 ? item.price : goods[3]
      end
    end
    if SHOW1
      @data += $game_party.all_items.select {|item| include?(item)}
      @data.uniq!
    end
    @data = @data.select{|item| $game_party.has_item?(item)} unless SHOW2
    @data.push(nil) if include?(nil)
  end
  def enable?(item)
    item && (@price[item] ? @price[item] > 0 : item.price > 0) && $game_party.has_item?(item)
  end
end
class Command < Window_ShopCommand
  def col_max; @list.size; end
  def make_command_list
    super
    @list.delete_if { |command| command[:symbol] == :buy }
  end
end
Scene_Clone = Scene_Shop.clone
class Scene_Clone
  Window_ShopCommand = M5SS20151022::Command
  Window_ShopSell = M5SS20151022::Sell
end
class Scene < Scene_Clone
  def create_sell_window
    super
    @sell_window.shop_goods = @goods
  end
  def selling_price; buying_price || super; end
end

end # module M5SS20151022

class Game_Interpreter
  alias m5_20140320_command_302 command_302
  def command_302
    temp_scene = Scene_Shop
    if $game_switches[M5SS20151022::SWI]
      Object.const_set(:Scene_Shop, M5SS20151022::Scene)
      ( @params = @params.clone )[4] = false
    end
    m5_20140320_command_302
    Object.const_set(:Scene_Shop, temp_scene)
  end
end
8

鸡蛋
1

鲜花

刚表态过的朋友 (9 人)

发表评论 评论 (2 个评论)

回复 VIPArcher 2014-5-15 11:33
提个建议,出售道具能不能做成不分类的呢,反正都是要卖的分类的意义不大而且还麻烦。
回复 melove603 2015-3-15 00:00
会用啦………原来一直是自己设置错了  赞~\(≧▽≦)/~

facelist doodle 涂鸦笔

您需要登录后才可以评论 登录 | 注册会员

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-29 07:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

返回顶部