Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # Kadafi - Multi Currency
- # Version : 1.1
- # Contact : http://kakakadafi.blogspot.com or umarqadafi1@hotmail.com
- # =============================================================================
- ($imported ||= {})[:Kadafi_MultiCurrency] = true
- # =============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2014.06.22 - Started and Finished script
- # 2014.06.22 - Bugfix: Items still buyable even if the money is not enough to buy the items.
- # =============================================================================
- =begin
- Introduction :
- This script allows you to have an auto Money Changer in shop.
- You can call this "Multi Currency" System. :v
- How to Use :
- [*] Script call :
- Kadafi::MultiCurrency = true >>> To activate this script.
- Kadafi::CurrencySymbol = "Up to you" >>> To set the currency symbol.
- Kadafi::ExchangeRates = amount >>> To set the currency exchange rates.
- Example : <<< Call this on every map if you want to have different Exchange Rates.
- Kadafi::MultiCurrency = true
- Kadafi::CurrencySymbol = "$"
- Kadafi::ExchangeRates = 10000
- TERMS OF USE :
- Free for use on any non-Commercial or Commercial Game Projects.
- If you use this for commercial uses,
- give me a free copy of your game would be nice :)
- Credit: Kadafi
- =end
- # =============================================================================
- # Configuration - Don't edit this configuration.
- # =============================================================================
- module Kadafi
- MultiCurrency = false
- CurrencySymbol = ""
- ExchangeRates = 1
- end
- # =============================================================================
- # End of Configuration
- # =============================================================================
- class Window_ShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # * New Method : Get New Price of Item
- #--------------------------------------------------------------------------
- def new_price(item)
- if Kadafi::MultiCurrency
- @price[item] * Kadafi::ExchangeRates
- else
- @price[item]
- end
- end
- #--------------------------------------------------------------------------
- # * Overwritten Method : Display in Enabled State?
- #--------------------------------------------------------------------------
- def enable?(item)
- if Kadafi::MultiCurrency
- item && new_price(item) <= @money && !$game_party.item_max?(item)
- else
- item && price(item) <= @money && !$game_party.item_max?(item)
- end
- end
- #--------------------------------------------------------------------------
- # * Overwritten Method : Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- rect = item_rect(index)
- draw_item_name(item, rect.x, rect.y, enable?(item))
- if Kadafi::MultiCurrency
- draw_currency_value(price(item), Kadafi::CurrencySymbol, 4, 0, contents.width - 8)
- else
- draw_currency_value(price(item), Vocab::currency_unit, 4, 0, contents.width - 8)
- end
- end
- end
- class Window_ShopStatus < Window_Base
- #--------------------------------------------------------------------------
- # * Alias Method : Refresh
- #--------------------------------------------------------------------------
- alias new_refresh refresh
- def refresh
- new_refresh
- draw_exchange_rates(4, line_height * 1)
- end
- #--------------------------------------------------------------------------
- # * New Method : Draw Exchange Rates
- #--------------------------------------------------------------------------
- def draw_exchange_rates(x, y)
- rect = Rect.new(x, y, contents.width - 4 - x, line_height)
- change_color(system_color)
- draw_text(rect, "Exchange Rates")
- if Kadafi::MultiCurrency
- draw_currency_value(Kadafi::ExchangeRates, Vocab::currency_unit, 4, line_height * 1, contents.width - 8)
- else
- draw_currency_value("1", Vocab::currency_unit, 4, line_height * 1, contents.width - 8)
- end
- end
- end
- class Scene_Shop < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Overwritten Method : Get Purchase Price
- #--------------------------------------------------------------------------
- def buying_price
- @buy_window.new_price(@item)
- end
- #--------------------------------------------------------------------------
- # * Overwritten Methd : Get Sale Price
- #--------------------------------------------------------------------------
- def selling_price
- if Kadafi::MultiCurrency
- @buy_window.new_price(@item) / 2
- else
- @item.price / 2
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement