Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Simple Gold Window
- # Author: Nicke
- # Created: 06/06/2011
- # Edited: 05/12/2011
- # Version: 1.1a
- # Optimized/modified by Jet and IceDragon so credits to them too!
- #==============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #==============================================================================
- ($imported ||= {})["NICKE-GoldWindow"] = true
- module NICKE
- module GOLD_SETTINGS
- #==============================================================================#
- # ** Settings
- #==============================================================================#
- # GOLD_FONT |FONT| |SIZE| |COLOR| |SHADOW|
- GOLD_FONT = ["Rockwell", 14, Color.new(255,215,100), true]
- # GOLD_WINDOW |X| |Y| |Z| |OPACITY| |SKIN|
- GOLD_WINDOW = [498, 422, 99700, 0, ""]
- # GOLD |ICON| |VISIBLITY| |SHOW_ICON| |SHOW_VOCAB|
- GOLD = [3300, 1, true, false]
- # GOLD_COUNT |SOUND| |VOL| |PITCH| |PLAY|
- GOLD_COUNT = ["", 60, 100, false]
- # Count timer for updating the gold.
- GOLD_COUNT_WAIT = 1
- # The time lapse between gold count changing.
- GOLD_CHANGING = 2
- end
- end
- # *** Don't edit below unless you know what you are doing. ***
- #==============================================================================#
- # ** Window_Base
- #------------------------------------------------------------------------------
- # Method for drawing the gold.
- #==============================================================================#
- include NICKE::GOLD_SETTINGS
- class Window_Base < Window
- def draw_gold(value, x, y, width)
- cx = contents.text_size(Vocab::gold).width
- self.contents.font.name = GOLD_FONT[0]
- self.contents.font.size = GOLD_FONT[1]
- self.contents.font.color = GOLD_FONT[2]
- self.contents.font.shadow = GOLD_FONT[3]
- self.contents.draw_text(x - 16, y, width-cx-2, WLH, value, 2)
- #// If true change x and y postion.
- self.contents.draw_text(x - 20, y, width-cx-2, WLH, Vocab::gold, 2) if GOLD[3] == true
- end
- end
- #==============================================================================
- # ** Simple_Gold_Window
- #------------------------------------------------------------------------------
- # This window displays the amount of gold and draw an icon.
- #==============================================================================
- class Simple_Gold_Window < Window_Base
- def initialize(x, y)
- super(x, y, 250, 300)
- @last_gold = $game_party.gold # // Used for updating.
- @wait_period = GOLD_COUNT_WAIT # // Used for a wait period for gold count changing.
- refresh
- end
- def refresh
- self.contents.clear
- draw_gold(@last_gold, 4, 0, 120) # // Draw gold.
- draw_icon(GOLD[0], 94, 0) if GOLD[2] == true
- end
- def update
- super
- @wait_period -= 1 if @wait_period != 0
- if @last_gold != $game_party.gold and @wait_period == 0 # // If gold has changed, refresh.
- if @last_gold < $game_party.gold
- @last_gold += 1
- else
- @last_gold -= 1
- end
- if self.visible
- RPG::SE.new(GOLD_COUNT[0], GOLD_COUNT[1], [2]).play if GOLD_COUNT[3]
- end
- refresh
- @wait_period = GOLD_CHANGING
- end
- end
- end
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # Show gold window on the map.
- #==============================================================================
- class Scene_Map < Scene_Base
- alias nicke_gold_window_start start unless $@
- def start(*args, &block)
- nicke_gold_window_start(*args, &block)
- create_gold_window
- @gold_window.visible = $game_switches[GOLD[1]]
- end
- alias nicke_gold_window_terminate terminate unless $@
- def terminate(*args, &block)
- nicke_gold_window_terminate(*args, &block)
- dispose_gold_window
- end
- def create_gold_window
- @gold_window = Simple_Gold_Window.new(GOLD_WINDOW[0], GOLD_WINDOW[1])
- @gold_window.z = GOLD_WINDOW[2]
- @gold_window.opacity = GOLD_WINDOW[3]
- @gold_window.windowskin = Cache.system(GOLD_WINDOW[4]) unless GOLD_WINDOW[4] == ""
- end
- def dispose_gold_window
- @gold_window.dispose unless @gold_window.nil?
- @gold_window = nil
- end
- alias nicke_gold_window_update update unless $@
- def update(*args, &block)
- nicke_gold_window_update(*args, &block)
- @gold_window.update
- @gold_window.visible = $game_switches[GOLD[1]]
- end
- end # END OF FILE
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement