Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ╔══════════════════════════════════════════════════════╤═══════╤════════════╗
- # ║ Alternate Currency │ v2.00 │ (03/25/14) ║
- # ╠══════════════════════════════════════════════════════╧═══════╧════════════╣
- # ║ Author : William Couillard ║
- # ║ E-Mail : cooliebk18@yahoo.com ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ABOUT ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ This script allows the user to change shops to use an alternate currency ║
- # ║ which is stored in a variable. The new currency can be turned on or off ║
- # ║ at any time. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ CHANGE LOG ║
- # ╠═════════════════════════════════════════════════════════════════╤═════════╣
- # ║ ■ March 25, 2014 : Removed depencency on YEA Shop Options. │ (v2.00) ║
- # ║ ■ January 24, 2012 : Initial release. │ (v1.00) ║
- # ╠═════════════════════════════════════════════════════════════════╧═════════╣
- # ║ OVERWRITTEN METHODS ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ This script overwrites a few methods in various default scripts. ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ class Window_ShopNumber < Window_Selectable ║
- # ║ ► def draw_total_price ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ class Window_Gold < Window_Base ║
- # ║ ► def refresh ║
- # ║ ► def value ║
- # ║ ► def currency_unit ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ class Scene_Shop < Scene_MenuBase ║
- # ║ ► def do_buy ║
- # ║ ► def do_sell ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ NEW METHODS ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ There are several new methods introduced in this script. ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ class Game_Party < Game_Unit ║
- # ║ ► def gain_bp ║
- # ║ ► def lose_bp ║
- # ║ ► def max_bp ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ class Window_ShopNumber < Window_Selectable ║
- # ║ ► def current_currency_value ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ INSTRUCTIONS ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ Paste this script below Materials and above Main. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ IMPORT SETTING ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- $imported = {} if $imported.nil? # Do not edit
- $imported[:wc_alternate_currency] = true # Do not edit
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ CUSTOMIZATION MODULE ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- module COOLIE
- module ALT_CURRENCY
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - New Currency Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Changes settings for the new currency used in shops.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- CURRENCY_SWITCH = 1 # Currency Change Switch ID
- # ^ When this switch is ON, shops use
- # alternate currency.
- CURRENCY_VARIABLE = 1 # Currency Variable ID
- # ^ Variable that stores the currency
- # value.
- CURRENCY_NAME = "BP" # Currency Name
- # ^ The name of the alternate currency.
- MAX_ALT_CURRENCY = 9999999 # Maximum Alternate Currency Amount
- # ^ The maximum amount of alternate
- # currency that can be held at once.
- end
- end
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # * new method: gain_bp
- #--------------------------------------------------------------------------
- def gain_bp(amount)
- $game_variables[COOLIE::ALT_CURRENCY::CURRENCY_VARIABLE] = [[$game_variables[COOLIE::ALT_CURRENCY::CURRENCY_VARIABLE] + amount, 0].max, max_bp].min
- end
- #--------------------------------------------------------------------------
- # * new method: lose_bp
- #--------------------------------------------------------------------------
- def lose_bp(amount)
- gain_bp(-amount)
- end
- #--------------------------------------------------------------------------
- # * new method: def max_bp
- #--------------------------------------------------------------------------
- def max_bp
- return COOLIE::ALT_CURRENCY::MAX_ALT_CURRENCY
- end
- end
- #==============================================================================
- # ■ Window_ShopNumber
- #==============================================================================
- class Window_ShopNumber < Window_Selectable
- #--------------------------------------------------------------------------
- # * Draw Total Price
- #--------------------------------------------------------------------------
- def draw_total_price
- if $imported["YEA-ShopOptions"]
- dw = contents_width - 8
- dy = price_y
- # Draw total currency
- draw_currency_value(current_currency_value, @currency_unit, 4, dy, dw)
- dy += line_height
- draw_horz_line(dy)
- # Draw total cost
- value = @price * @number
- value *= -1 if buy?
- draw_currency_value(value, @currency_unit, 4, dy, dw)
- dy += line_height
- # Draw remaining currency
- value = current_currency_value + value
- if $game_switches[COOLIE::ALT_CURRENCY::CURRENCY_SWITCH]
- value = [[value, 0].max, $game_party.max_bp].min
- else
- value = [[value, 0].max, $game_party.max_gold].min
- end
- draw_currency_value(value, @currency_unit, 4, dy, dw)
- else
- width = contents_width - 8
- draw_currency_value(@price * @number, @currency_unit, 4, price_y, width)
- end
- end
- #--------------------------------------------------------------------------
- # * new method: current_currency_value
- #--------------------------------------------------------------------------
- def current_currency_value
- if $game_switches[COOLIE::ALT_CURRENCY::CURRENCY_SWITCH]
- return $game_variables[COOLIE::ALT_CURRENCY::CURRENCY_VARIABLE]
- else
- return $game_party.gold
- end
- end
- end # Game_Party
- #==============================================================================
- # ■ Window_Gold
- #==============================================================================
- class Window_Gold < Window_Base
- #--------------------------------------------------------------------------
- # * overwrite method: refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
- end
- #--------------------------------------------------------------------------
- # * overwrite method: value
- #--------------------------------------------------------------------------
- def value
- if $game_switches[COOLIE::ALT_CURRENCY::CURRENCY_SWITCH]
- $game_variables[COOLIE::ALT_CURRENCY::CURRENCY_VARIABLE]
- else
- $game_party.gold
- end
- end
- #--------------------------------------------------------------------------
- # * overwrite method: currency_unit
- #--------------------------------------------------------------------------
- def currency_unit
- if $game_switches[COOLIE::ALT_CURRENCY::CURRENCY_SWITCH]
- COOLIE::ALT_CURRENCY::CURRENCY_NAME
- else
- Vocab::currency_unit
- end
- end
- end # Window_Gold
- #==============================================================================
- # ■ Scene_Shop
- #==============================================================================
- class Scene_Shop < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * overwrite method: do_buy
- #--------------------------------------------------------------------------
- def do_buy(number)
- if $game_switches[COOLIE::ALT_CURRENCY::CURRENCY_SWITCH]
- $game_party.lose_bp(number * buying_price)
- else
- $game_party.lose_gold(number * buying_price)
- end
- $game_party.gain_item(@item, number)
- end
- #--------------------------------------------------------------------------
- # * overwrite method: do_sell
- #--------------------------------------------------------------------------
- def do_sell(number)
- if $game_switches[COOLIE::ALT_CURRENCY::CURRENCY_SWITCH]
- $game_party.gain_bp(number * selling_price)
- else
- $game_party.gain_gold(number * selling_price)
- end
- $game_party.lose_item(@item, number)
- end
- end # Scene_Shop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement