#============================================================================== # ○ぼったくりor割引 Ver1.00 # for RGSS2 # 西瓜 / Space not far # http://muspell.raindrop.jp/ # ショップのアイテムの購入価格を変動させます。 #============================================================================== # ショップのアイテムの価格がつねに設定した変数の値/100倍されます。 # 再定義を行っているのでできるだけ上のセクションに置いてください。 module SNF BUY_PRICE_ID = 10 # 価格のパーセンテージを代入する変数ID SELL_CHANGE = false # 売却価格も変動させるか?(true/false) SELL_RATE = 50 # 売却価格の購入価格に対するパーセンテージ def self.buy_price(price) price *= $game_variables[BUY_PRICE_ID] price /= 100 return price end def self.sell_price(price) price = self.buy_price(price) if SELL_CHANGE price *= SELL_RATE price /= 100 return price end end module RPG class Item < UsableItem def price return SNF.buy_price(@price) end def sell_price return SNF.sell_price(@price) end end class Weapon < BaseItem def price return SNF.buy_price(@price) end def sell_price return SNF.sell_price(@price) end end class Armor < BaseItem def price return SNF.buy_price(@price) end def sell_price return SNF.sell_price(@price) end end end class Scene_Shop < Scene_Base # 再定義 #-------------------------------------------------------------------------- # ● 売却アイテム選択の更新 #-------------------------------------------------------------------------- def update_sell_selection if Input.trigger?(Input::B) Sound.play_cancel @command_window.active = true @dummy_window.visible = true @sell_window.active = false @sell_window.visible = false @status_window.item = nil @help_window.set_text("") elsif Input.trigger?(Input::C) @item = @sell_window.item @status_window.item = @item if @item == nil or @item.price == 0 Sound.play_buzzer else Sound.play_decision max = $game_party.item_number(@item) @sell_window.active = false @sell_window.visible = false @number_window.set(@item, max, @item.sell_price) @number_window.active = true @number_window.visible = true @status_window.visible = true end end end #-------------------------------------------------------------------------- # ● 個数入力の決定 #-------------------------------------------------------------------------- def decide_number_input Sound.play_shop @number_window.active = false @number_window.visible = false case @command_window.index when 0 # 購入する $game_party.lose_gold(@number_window.number * @item.price) $game_party.gain_item(@item, @number_window.number) @gold_window.refresh @buy_window.refresh @status_window.refresh @buy_window.active = true @buy_window.visible = true when 1 # 売却する $game_party.gain_gold(@number_window.number * (@item.sell_price)) $game_party.lose_item(@item, @number_window.number) @gold_window.refresh @sell_window.refresh @status_window.refresh @sell_window.active = true @sell_window.visible = true @status_window.visible = false end end end