vindaca510

V's Simple Replace: Gold Icon v0.2

Feb 21st, 2014
561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.97 KB | None | 0 0
  1. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  2. #                                                                              #
  3. #                             V's  Simple Replace:                             #
  4. #                                  Gold  Icon                                  #
  5. #                                 Version  0.2                                 #
  6. #                                                                              #
  7. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  8. #                                Written By:  V                                #
  9. #                        Last Edited: February 21, 2013                        #
  10. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  11. #                                                                              #
  12. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  13.  
  14.  
  15. #==============================================================================#
  16. #------------------------------------------------------------------------------#
  17. # ** Disclaimer                                                                #
  18. #------------------------------------------------------------------------------#
  19. #                                                                              #
  20. # This script was intended for Non-commercial use only, if you wish to use     #
  21. # this script in a commercial game please PM me at which ever site you found   #
  22. # this script. Either way please give me credit in your game script as the     #
  23. # writer of this script, and send me a PM abuot the release of the game/demo.  #
  24. #                                                                              #
  25. #------------------------------------------------------------------------------#
  26. # ** How To Use                                                                #
  27. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  28. #                                                                              #
  29. #  * This script is Plug & Play.                                               #
  30. #                                                                              #
  31. #------------------------------------------------------------------------------#
  32. # ** Description                                                               #
  33. #------------------------------------------------------------------------------#
  34. #                                                                              #
  35. #  v0.1                                                                        #
  36. # ~=~=~=~                                                                      #
  37. #                                                                              #
  38. # * In v0.1, this script replaces gold vocab with an icon in the Gold window.  #
  39. # It also replaces game message's \g with an icon, however the gold vocab is   #
  40. # still available with \gv instead.                                            #
  41. #                                                                              #
  42. #  v0.2                                                                        #
  43. # ~=~=~=~                                                                      #
  44. #                                                                              #
  45. # * I added an option to change the Gold Window vocab to an icon. I also added #
  46. # the same escape characters to the Choices Window as the Message Window.      #
  47. #                                                                              #
  48. #------------------------------------------------------------------------------#
  49. #==============================================================================#
  50.  
  51. #==============================================================================
  52. # ** V's Simple Replace: Gold Icon
  53. #------------------------------------------------------------------------------
  54. #  This module manages customizable features and methods.
  55. #==============================================================================
  56.  
  57. module V_Simple_Replace_Gold_Icon
  58.   module Specs
  59.  
  60. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  61. #                                                                              #
  62. #                           Start Customizable Area.                           #
  63. #                                                                              #
  64. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  65. #                                                                              #
  66. #                      ONLY EDIT AFTER THE EQUALS SYMBOL.                      #
  67. #                                                                              #
  68. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  69.    
  70.  
  71.   #=============================================================================
  72.   # Gold Icon:
  73.   #=============================================================================
  74.   Gold_Icon = 361
  75.  
  76.   #=============================================================================
  77.   # Change the Gold Window Vocab Into an Icon:
  78.   #=============================================================================
  79.   Change_Gold_Window = false
  80.  
  81.  
  82. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  83. #                                                                              #
  84. #                            End Customizable Area.                            #
  85. #                                                                              #
  86. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  87. #                                                                              #
  88. #         DO NOT EDIT PAST THIS POINT UNLESS YOU KNOW WHAT YOUR DOING.         #
  89. #                                                                              #
  90. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  91.    
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. end
  128. end
  129.  
  130.  
  131. #==============================================================================
  132. # ** Window_Base
  133. #------------------------------------------------------------------------------
  134. #  This is a super class of all windows within the game.
  135. #==============================================================================
  136.  
  137. class Window_Base < Window
  138.  
  139.   #--------------------------------------------------------------------------
  140.   # * Include Module
  141.   #--------------------------------------------------------------------------
  142.   include V_Simple_Replace_Gold_Icon::Specs
  143.    
  144.   #--------------------------------------------------------------------------
  145.   # * Draw Number (Gold Etc.) with Currency Unit
  146.   #--------------------------------------------------------------------------
  147.   def draw_currency_value(value, unit, x, y, width)
  148.     cx = text_size(unit).width
  149.     change_color(normal_color)
  150.     draw_text(x - 5, y, width - cx - 2, line_height, value, 2)
  151.     change_color(system_color)
  152.     if Change_Gold_Window != true
  153.       draw_text(x, y, width, line_height, unit, 2)
  154.     else
  155.       draw_text(x, y, width, line_height, unit, 2) unless unit == Vocab::currency_unit
  156.       draw_icon(Gold_Icon, width - 14, y) if unit == Vocab::currency_unit
  157.     end
  158.   end
  159.  
  160.   #--------------------------------------------------------------------------
  161.   # * Preconvert Control Characters
  162.   #    As a rule, replace only what will be changed into text strings before
  163.   #    starting actual drawing. The character "\" is replaced with the escape
  164.   #    character (\e).
  165.   #--------------------------------------------------------------------------
  166.   def convert_escape_characters(text)
  167.     result = text.to_s.clone
  168.     result.gsub!(/\\/)            { "\e" }
  169.     result.gsub!(/\e\e/)          { "\\" }
  170.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  171.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  172.     result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
  173.     result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
  174.     result.gsub!(/\eGV/i)         { Vocab::currency_unit }
  175.     result
  176.   end
  177.  
  178. end
  179.  
  180.  
  181. #==============================================================================
  182. # ** Window_ChoiceList
  183. #------------------------------------------------------------------------------
  184. #  This window is used for the event command [Show Choices].
  185. #==============================================================================
  186.  
  187. class Window_ChoiceList < Window_Command
  188.  
  189.   #--------------------------------------------------------------------------
  190.   # * Method for Aliasing: Control Character Processing
  191.   #--------------------------------------------------------------------------
  192.   alias :wclpec24324321 :process_escape_character
  193.    
  194.   #--------------------------------------------------------------------------
  195.   # * Control Character Processing
  196.   #     code : the core of the control character
  197.   #            e.g. "C" in the case of the control character \C[1].
  198.   #     text : character string buffer in drawing processing (destructive)
  199.   #     pos  : draw position {:x, :y, :new_x, :height}
  200.   #--------------------------------------------------------------------------
  201.   def process_escape_character(code, text, pos)
  202.     case code.upcase
  203.     when 'G'
  204.       process_draw_icon(Gold_Icon, pos)
  205.     end
  206.     wclpec24324321(code, text, pos)
  207.   end
  208.  
  209. end
  210.  
  211.  
  212. #==============================================================================
  213. # ** Window_Message
  214. #------------------------------------------------------------------------------
  215. #  This message window is used to display text.
  216. #==============================================================================
  217.  
  218. class Window_Message < Window_Base
  219.  
  220.   #--------------------------------------------------------------------------
  221.   # * Include Module
  222.   #--------------------------------------------------------------------------
  223.   include V_Simple_Replace_Gold_Icon::Specs
  224.    
  225.   #--------------------------------------------------------------------------
  226.   # * Method for Aliasing: Control Character Processing
  227.   #--------------------------------------------------------------------------
  228.   alias :wmpec064506406 :process_escape_character
  229.    
  230.   #--------------------------------------------------------------------------
  231.   # * Control Character Processing
  232.   #     code : the core of the control character
  233.   #            e.g. "C" in the case of the control character \C[1].
  234.   #     text : character string buffer in drawing processing (destructive)
  235.   #     pos  : draw position {:x, :y, :new_x, :height}
  236.   #--------------------------------------------------------------------------
  237.   def process_escape_character(code, text, pos)
  238.     case code.upcase
  239.     when 'G'
  240.       process_draw_icon(Gold_Icon, pos)
  241.     end
  242.     wmpec064506406(code, text, pos)
  243.   end
  244.  
  245. end
Advertisement
Add Comment
Please, Sign In to add comment