Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==============================================================================
- # ▼▼▼▼▼▼ TroyZ - Theo Specific Sell Price ▼▼▼▼▼▼
- # ==============================================================================
- # Script by : Theo Allen
- # Edited by : Agung Prasetyo(TroyZ)
- # Contact me by : - Email agung.endisnear.xyz@gmail.com
- # - Forum RPGMakerID, username TroyZ
- # - Handphone 085756289121
- # Engine : VXAce
- # Level : Easy
- # Version : 1.0
- # ------------------------------------------------------------------------------
- # Change Logs :
- # 8 August 2013 : Version 1.0 released
- # 29 September 2014 : Version 1.0 edited by TroyZ released
- # ------------------------------------------------------------------------------
- # How this work :
- # Just adding another function to make the sell price appear as percentage.
- # Furthermore the rest of script instructions are in the old header of the
- # script's itself.
- # ------------------------------------------------------------------------------
- # How to use :
- # Place it between material and main. To use percentage sell price, use this
- # notetag :
- #
- # <sell price mul: x%>
- #
- # For example :
- #
- # <sell price mul: 75%>
- # Means that this item has selling price at 75% of it's buying price. The
- # percentage selling price has higher priority than fixed selling price.
- # ------------------------------------------------------------------------------
- # Compatibility issues :
- # None yet. If you found some, let me or Theo know, and bug fixes will come out
- # soon.
- # ------------------------------------------------------------------------------
- # Who to credit :
- # - Allah swt. : For the chance of living that he has given to me.
- # - Nabi Muhammad saw. : As a leader and messenger and prophet of Muslim.
- # I'm proud to be your follower. :)
- # - Theo Allen : It's his script, credit him.
- # - Agung Prasetyo(TroyZ) : Whatever, but if you pleased, just credit me, hehehe.
- # ------------------------------------------------------------------------------
- # License :
- # - Free Game : Follow Theo's credit rules.
- # - Commercial Game : Same as free game's license.
- # ------------------------------------------------------------------------------
- # =============================================================================
- # TheoAllen - Specific Sell Price
- # Version : 1.0
- # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
- # (This script documentation is written in informal indonesian language)
- # =============================================================================
- ($imported ||= {})[:Theo_SellPrice] = true
- # =============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2013.08.11 - Finished script
- # =============================================================================
- =begin
- Perkenalan :
- Script ini berfungsi untuk spesifikasi harga item
- Cara penggunaan :
- Pasang dibawah material namun diatas main
- Gunakan tag <sell price: n> pada note armor, weapon, dan item. Dimana n
- adalah harga jual barang tersebut.
- Terms of Use :
- Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
- keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
- dipake buat komersil, jangan lupa, gw dibagi gratisannya.
- =end
- # =============================================================================
- # Tidak ada konfigurasi
- # =============================================================================
- class << DataManager
- alias theo_sell_price_load_db load_database
- def load_database
- theo_sell_price_load_db
- load_price_database
- end
- def load_price_database
- ($data_armors + $data_weapons + $data_items).compact.each do |item|
- item.load_price
- end
- end
- end
- class RPG::Item < RPG::UsableItem
- attr_accessor :sell_price
- attr_accessor :sell_price_mult
- def load_price
- @sell_price = 0
- @sell_price_mult = 0
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when /<(?:SELL_PRICE|sell price): [ ]*(\d+)>/i
- @sell_price = $1.to_i
- when /<(?:SELL_PRICE_MUL|sell price mul): [ ]*(\d+)%>/i
- @sell_price_mult = $1.to_i * 0.01
- end
- end
- end
- def specify_sell_price_multiplier?
- @sell_price_mult > 0
- end
- def specify_sell_price?
- @sell_price > 0
- end
- end
- class RPG::EquipItem < RPG::BaseItem
- attr_accessor :sell_price
- attr_accessor :sell_price_mult
- def load_price
- @sell_price = 0
- @sell_price_mult = 0
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when /<(?:SELL_PRICE|sell price): [ ]*(\d+)>/i
- @sell_price = $1.to_i
- when /<(?:SELL_PRICE_MUL|sell price mul): [ ]*(\d+)%>/i
- @sell_price_mult = $1.to_i * 0.01
- end
- end
- end
- def specify_sell_price_multiplier?
- @sell_price_mult > 0
- end
- def specify_sell_price?
- @sell_price > 0
- end
- end
- class Scene_Shop < Scene_MenuBase
- alias theo_ori_sell_price selling_price
- def selling_price
- return (@item.price * @item.sell_price_mult).to_i if @item.specify_sell_price_multiplier?
- return @item.sell_price if @item.specify_sell_price?
- return theo_ori_sell_price
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement