Advertisement
Guest User

Untitled

a guest
Nov 29th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 39.54 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Status Menu v1.01
  4. # -- Last Updated: 2011.12.26
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-StatusMenu"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2011.12.26 - Compatibility Update: Rename Actor
  17. # 2011.12.23 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This script changes the status screen completely to something the player can
  23. # interact with more and be able to view actor data with more clarity. The
  24. # player is able to view the general information for an actor (parameters and
  25. # experience), a parameters bar graph, the various hidden extra parameters
  26. # (named properties in the script), and a customizable biography for the actor.
  27. # Also with this script, biographies can be changed at any time using a script
  28. # call to add more of a personal touch to characters.
  29. #
  30. #==============================================================================
  31. # ▼ Instructions
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # To install this script, open up your script editor and copy/paste this script
  34. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  35. #
  36. # -----------------------------------------------------------------------------
  37. # Script Calls - These commands are used with script calls.
  38. # -----------------------------------------------------------------------------
  39. # $game_actors[x].description = string
  40. # Changes the biography description for actor x to that of the string. Use \n
  41. # to designate linebreaks in the string. If you wish to use text codes, write
  42. # them in the strings as \\n[2] or \\c[3] to make them work properly.
  43. #
  44. #==============================================================================
  45. # ▼ Compatibility
  46. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  47. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  48. # it will run with RPG Maker VX without adjusting.
  49. #
  50. #==============================================================================
  51.  
  52. module YEA
  53.   module STATUS
  54.    
  55.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  56.     # - Command Window Settings -
  57.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58.     # This section adjusts the commands that appear in the command window used
  59.     # for the status screen. Rearrange the commands, add new ones, remove them
  60.     # as you see fit.
  61.     #
  62.     # -------------------------------------------------------------------------
  63.     # :command         Description
  64.     # -------------------------------------------------------------------------
  65.     # :general         Adds general page.
  66.     # :parameters      Adds parameters page.
  67.     # :properties      Adds properties page.
  68.     # :biography       Adds biography page.
  69.     #
  70.     # :rename          Requires YEA - Rename Actor
  71.     # :retitle         Requires YEA - Retitle Actor
  72.     #
  73.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  74.     COMMANDS =[ # The order at which the menu items are shown.
  75.     # [    :command,    "Display"],
  76.       [    :general,    "Général"],
  77.       [ :parameters, "Paramètres"],
  78.       [ :stat_change, "Attributs"],
  79.     # [ :properties, "Propriétés"],
  80.       [    :custom1,  "Attribuer"],
  81.     #  [    :custom2,  "Arcanum"], #test
  82.     # [    :custom2,  "Equipment"],
  83.     # [    :custom3,      "Class"],
  84.     #  [  :biography,  "Biography"],
  85.       [     :rename,     "Rename"],  # Requires YEA - Rename Actor
  86.       [    :retitle,    "Retitle"],  # Requires YEA - Rename Actor
  87.     ] # Do not remove this.
  88.    
  89.     #--------------------------------------------------------------------------
  90.     # - Status Custom Commands -
  91.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  92.     # For those who use scripts to that may produce unique effects for the
  93.     # status menu, use this hash to manage the custom commands for the Status
  94.     # Command Window. You can disable certain commands or prevent them from
  95.     # appearing by using switches. If you don't wish to bind them to a switch,
  96.     # set the proper switch to 0 for it to have no impact.
  97.     #--------------------------------------------------------------------------
  98.     CUSTOM_STATUS_COMMANDS ={
  99.     # :command => [EnableSwitch, ShowSwitch, Handler Method, Window Draw],
  100.       :custom1 => [           0,          0, :command_name1, :draw_custom1],
  101.      # :custom2 => [           0,          0, :upgrade, :draw_custom2],
  102.      # :custom4 => [           0,          0, :command_name3, :draw_custom3],
  103.       } # Do not remove this.
  104.  
  105.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  106.     # - General Window Settings -
  107.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  108.     # These settings adjust the way the general window visually appears.
  109.     # Not many changes need to be done here other than vocab changes.
  110.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  111.     PARAMETERS_VOCAB = "Paramètres"         # Title used for Parameters.
  112.     EXPERIENCE_VOCAB = "Experience"         # Title used for Experience.
  113.     NEXT_TOTAL_VOCAB = "Total pour prochain %s"  # Label used for total experience.
  114.    
  115.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  116.     # - Parameters Window Settings -
  117.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  118.     # These settings adjust the way the parameters window visually appears.
  119.     # Each of the stats have a non-window colour. Adjust them as you see fit.
  120.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  121.     PARAM_COLOUR ={
  122.     # ParamID => [:stat,       Colour1,                   Colour2          ],
  123.             2 => [ :atk, Color.new(225, 100, 100), Color.new(240, 150, 150)],
  124.             3 => [ :def, Color.new(250, 150,  30), Color.new(250, 180, 100)],
  125.             4 => [ :mat, Color.new( 70, 140, 200), Color.new(135, 180, 230)],
  126.             5 => [ :mdf, Color.new(135, 130, 190), Color.new(170, 160, 220)],
  127.             6 => [ :agi, Color.new( 60, 180,  80), Color.new(120, 200, 120)],
  128.             7 => [ :luk, Color.new(255, 240, 100), Color.new(255, 250, 200)],
  129.     } # Do not remove this.
  130.    
  131.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  132.     # - Properties Window Settings -
  133.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  134.     # These settings adjust the way the properties window visually appears.
  135.     # The properties have abbreviations, but leaving them as such makes things
  136.     # confusing (as it's sometimes hard to figure out what the abbreviations
  137.     # mean). Change the way the appear, whether or not they appear, and what
  138.     # order they will appear in.
  139.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  140.     PROPERTIES_FONT_SIZE = 16        # Font size used for properties.
  141.    
  142.     # These are the properties that appear in column 1.
  143.     PROPERTIES_COLUMN1 =[
  144.       [:hit, "Toucher"],
  145.       [:eva, "Evasion"],
  146.       [:cri, "Critique"],
  147.       [:cev, "Rés. Crit"],
  148. #     [:mev, "Eva. de magie"],
  149.       [:mrf, "Reflet magie"],
  150. #     [:cnt, "Contre-attaque"],
  151.       [:tgr, "Menace"],
  152.       [:pdr, "Dégâts phys."],
  153.       [:mdr, "Dégâts mag."],            
  154.  
  155.     ] # Do not remove this.
  156.    
  157.     # These are the properties that appear in column 2.
  158.     PROPERTIES_COLUMN2 =[
  159.       [:mcr, "Coût Magies"],
  160.       [:tcr, "Coût Comp."],    # Requires YEA - Skill Cost Manager      
  161.       [:hrg, "Pv Regen"],
  162.       [:mrg, "Pm Regen"],
  163.       [:trg, "En Regen"],
  164. #     [:rec, "Guérison"],
  165. #     [:grd, "Parade"],
  166.       [:pha, "Bonus objets"],  
  167.       [:exr, "Taux d'exp"],
  168.       [:tcr, "Générat°En."],  
  169.     ] # Do not remove this.
  170.    
  171.     # These are the properties that appear in column 3.
  172.     PROPERTIES_COLUMN3 =[
  173.       [:hcr, "HP Cost Rate"],    # Requires YEA - Skill Cost Manager
  174.       [:cdr, "Cooldown Rate"],   # Requires YEA - Skill Restrictions
  175.       [:wur, "Warmup Rate"],     # Requires YEA - Skill Restrictions
  176.    #   [:fdr, "Dégâts pièges"],
  177.     ] # Do not remove this.
  178.    
  179.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  180.     # - Biography Window Settings -
  181.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  182.     # These settings adjust the way the biography appears including the title
  183.     # used at the top, the font size, and whatnot.
  184.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  185.     BIOGRAPHY_NICKNAME_TEXT = "%s the %s"   # How the nickname will appear.
  186.     BIOGRAPHY_NICKNAME_SIZE = 32            # Size of the font used.
  187.    
  188.   end # STATUS
  189. end # YEA
  190.  
  191. #==============================================================================
  192. # ▼ Editting anything past this point may potentially result in causing
  193. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  194. # halitosis so edit at your own risk.
  195. #==============================================================================
  196.  
  197. #==============================================================================
  198. # ■ Numeric
  199. #==============================================================================
  200.  
  201. class Numeric
  202.  
  203.   #--------------------------------------------------------------------------
  204.   # new method: group_digits
  205.   #--------------------------------------------------------------------------
  206.   unless $imported["YEA-CoreEngine"]
  207.   def group; return self.to_s; end
  208.   end # $imported["YEA-CoreEngine"]
  209.    
  210. end # Numeric
  211.  
  212. #==============================================================================
  213. # ■ Game_Temp
  214. #==============================================================================
  215.  
  216. class Game_Temp
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # public instance variables
  220.   #--------------------------------------------------------------------------
  221.   attr_accessor :scene_status_index
  222.   attr_accessor :scene_status_oy
  223.  
  224. end # Game_Temp
  225.  
  226. #==============================================================================
  227. # ■ Game_Actor
  228. #==============================================================================
  229.  
  230. class Game_Actor < Game_Battler
  231.  
  232.   #--------------------------------------------------------------------------
  233.   # new method: description=
  234.   #--------------------------------------------------------------------------
  235.   def description=(text)
  236.     @description = text
  237.   end
  238.  
  239.   #--------------------------------------------------------------------------
  240.   # overwrite method: description
  241.   #--------------------------------------------------------------------------
  242.   def description
  243.     return @description unless @description.nil?
  244.     return actor.description
  245.   end
  246.  
  247. end # Game_Actor
  248.  
  249. #==============================================================================
  250. # ■ Window_StatusCommand
  251. #==============================================================================
  252.  
  253. class Window_StatusCommand < Window_Command
  254.  
  255.   #--------------------------------------------------------------------------
  256.   # public instance variables
  257.   #--------------------------------------------------------------------------
  258.   attr_accessor :item_window
  259.  
  260.   #--------------------------------------------------------------------------
  261.   # initialize
  262.   #--------------------------------------------------------------------------
  263.   def initialize(dx, dy)
  264.     super(dx, dy)
  265.     @actor = nil
  266.   end
  267.  
  268.   #--------------------------------------------------------------------------
  269.   # window_width
  270.   #--------------------------------------------------------------------------
  271.   def window_width; return 160; end
  272.  
  273.   #--------------------------------------------------------------------------
  274.   # actor=
  275.   #--------------------------------------------------------------------------
  276.   def actor=(actor)
  277.     return if @actor == actor
  278.     @actor = actor
  279.     refresh
  280.   end
  281.  
  282.   #--------------------------------------------------------------------------
  283.   # visible_line_number
  284.   #--------------------------------------------------------------------------
  285.   def visible_line_number; return 4; end
  286.  
  287.   #--------------------------------------------------------------------------
  288.   # ok_enabled?
  289.   #--------------------------------------------------------------------------
  290.   def ok_enabled?
  291.     return handle?(current_symbol)
  292.   end
  293.  
  294.   #--------------------------------------------------------------------------
  295.   # make_command_list
  296.   #--------------------------------------------------------------------------
  297.   def make_command_list
  298.     return unless @actor
  299.     for command in YEA::STATUS::COMMANDS
  300.       case command[0]
  301.       #--- Default ---
  302.       when :general, :parameters, :properties, :biography
  303.         add_command(command[1], command[0])
  304.       #--- Yanfly Engine Ace ---
  305.       when :rename
  306.         next unless $imported["YEA-RenameActor"]
  307.         add_command(command[1], command[0], @actor.rename_allow?)
  308.       when :retitle
  309.         next unless $imported["YEA-RenameActor"]
  310.         add_command(command[1], command[0], @actor.retitle_allow?)
  311.       #--- Custom Commands ---
  312.       else
  313.         process_custom_command(command)
  314.       end
  315.     end
  316.     if !$game_temp.scene_status_index.nil?
  317.       select($game_temp.scene_status_index)
  318.       self.oy = $game_temp.scene_status_oy
  319.     end
  320.     $game_temp.scene_status_index = nil
  321.     $game_temp.scene_status_oy = nil
  322.   end
  323.  
  324.   #--------------------------------------------------------------------------
  325.   # process_ok
  326.   #--------------------------------------------------------------------------
  327.   def process_ok
  328.     $game_temp.scene_status_index = index
  329.     $game_temp.scene_status_oy = self.oy
  330.     super
  331.   end
  332.  
  333.   #--------------------------------------------------------------------------
  334.   # process_custom_command
  335.   #--------------------------------------------------------------------------
  336.   def process_custom_command(command)
  337.     return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
  338.     show = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][1]
  339.     continue = show <= 0 ? true : $game_switches[show]
  340.     return unless continue
  341.     text = command[1]
  342.     switch = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][0]
  343.     enabled = switch <= 0 ? true : $game_switches[switch]
  344.     add_command(text, command[0], enabled)
  345.   end
  346.  
  347.   #--------------------------------------------------------------------------
  348.   # update
  349.   #--------------------------------------------------------------------------
  350.   def update
  351.     super
  352.     update_item_window
  353.   end
  354.  
  355.   #--------------------------------------------------------------------------
  356.   # update_item_window
  357.   #--------------------------------------------------------------------------
  358.   def update_item_window
  359.     return if @item_window.nil?
  360.     return if @current_index == current_symbol
  361.     @current_index = current_symbol
  362.     @item_window.refresh
  363.   end
  364.  
  365.   #--------------------------------------------------------------------------
  366.   # item_window=
  367.   #--------------------------------------------------------------------------
  368.   def item_window=(window)
  369.     @item_window = window
  370.     update
  371.   end
  372.  
  373.   #--------------------------------------------------------------------------
  374.   # update_help
  375.   #--------------------------------------------------------------------------
  376.   def update_help
  377.     return if @actor.nil?
  378.     @help_window.set_text(@actor.actor.description)
  379.   end
  380.  
  381. end # Window_StatusCommand
  382.  
  383. #==============================================================================
  384. # ■ Window_StatusActor
  385. #==============================================================================
  386.  
  387. class Window_StatusActor < Window_Base
  388.  
  389.   #--------------------------------------------------------------------------
  390.   # initialize
  391.   #--------------------------------------------------------------------------
  392.   def initialize(dx, dy)
  393.     super(dx, dy, window_width, fitting_height(4))
  394.     @actor = nil
  395.   end
  396.  
  397.   #--------------------------------------------------------------------------
  398.   # window_width
  399.   #--------------------------------------------------------------------------
  400.   def window_width; return Graphics.width - 160; end
  401.  
  402.   #--------------------------------------------------------------------------
  403.   # actor=
  404.   #--------------------------------------------------------------------------
  405.   def actor=(actor)
  406.     return if @actor == actor
  407.     @actor = actor
  408.     refresh
  409.   end
  410.  
  411.   #--------------------------------------------------------------------------
  412.   # refresh
  413.   #--------------------------------------------------------------------------
  414.   def refresh
  415.     contents.clear
  416.     return unless @actor
  417.     draw_actor_face(@actor, 0, 0)
  418.     draw_actor_simple_status(@actor, 108, line_height / 2)
  419.   end
  420.  
  421. end # Window_StatusActor
  422.  
  423. #==============================================================================
  424. # ■ Window_StatusItem
  425. #==============================================================================
  426.  
  427. class Window_StatusItem < Window_Base
  428.  
  429.   #--------------------------------------------------------------------------
  430.   # initialize
  431.   #--------------------------------------------------------------------------
  432.   def initialize(dx, dy, command_window)
  433.     super(dx, dy, Graphics.width, Graphics.height - dy)
  434.     @command_window = command_window
  435.     @actor = nil
  436.     refresh
  437.   end
  438.  
  439.   #--------------------------------------------------------------------------
  440.   # actor=
  441.   #--------------------------------------------------------------------------
  442.   def actor=(actor)
  443.     return if @actor == actor
  444.     @actor = actor
  445.     refresh
  446.   end
  447.  
  448.   #--------------------------------------------------------------------------
  449.   # refresh
  450.   #--------------------------------------------------------------------------
  451.   def refresh
  452.     contents.clear
  453.     reset_font_settings
  454.     return unless @actor
  455.     draw_window_contents
  456.   end
  457.  
  458.   #--------------------------------------------------------------------------
  459.   # draw_window_contents
  460.   #--------------------------------------------------------------------------
  461.   def draw_window_contents
  462.     case @command_window.current_symbol
  463.     when :general
  464.       draw_actor_general
  465.     when :parameters
  466.       draw_parameter_graph
  467.     when :properties
  468.       draw_properties_list
  469.     when :biography, :rename, :retitle
  470.       draw_actor_biography
  471.     else
  472.       draw_custom
  473.     end
  474.   end
  475.  
  476.   #--------------------------------------------------------------------------
  477.   # draw_actor_general
  478.   #--------------------------------------------------------------------------
  479.   def draw_actor_general
  480.     change_color(system_color)
  481.     text = YEA::STATUS::PARAMETERS_VOCAB
  482.     draw_text(0, 0, contents.width/2, line_height, text, 1)
  483.     text = YEA::STATUS::EXPERIENCE_VOCAB
  484.     draw_text(contents.width/2, 0, contents.width/2, line_height, text, 1)
  485.     draw_general_parameters
  486.     draw_general_experience
  487.   end
  488.  
  489.   #--------------------------------------------------------------------------
  490.   # draw_general_parameters
  491.   #--------------------------------------------------------------------------
  492.   def draw_general_parameters
  493.     dx = 24
  494.     dy = line_height / 2
  495.     draw_actor_level(dx, line_height*1+dy, contents.width/2 - 24)
  496.     draw_actor_param(0, dx, line_height*2+dy, contents.width/2 - 24)
  497.     draw_actor_param(1, dx, line_height*3+dy, contents.width/2 - 24)
  498.     draw_actor_param(2, dx, line_height*4+dy, contents.width/4 - 12)
  499.     draw_actor_param(4, dx, line_height*5+dy, contents.width/4 - 12)
  500.     draw_actor_param(6, dx, line_height*6+dy, contents.width/4 - 12)
  501.     dx += contents.width/4 - 12
  502.     draw_actor_param(3, dx, line_height*4+dy, contents.width/4 - 12)
  503.     draw_actor_param(5, dx, line_height*5+dy, contents.width/4 - 12)
  504.     draw_actor_param(7, dx, line_height*6+dy, contents.width/4 - 12)
  505.   end
  506.  
  507.   #--------------------------------------------------------------------------
  508.   # draw_actor_level
  509.   #--------------------------------------------------------------------------
  510.   def draw_actor_level(dx, dy, dw)
  511.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  512.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  513.     contents.fill_rect(rect, colour)
  514.     change_color(system_color)
  515.     draw_text(dx+4, dy, dw-8, line_height, Vocab::level)
  516.     change_color(normal_color)
  517.     draw_text(dx+4, dy, dw-8, line_height, @actor.level.group, 2)
  518.   end
  519.  
  520.   #--------------------------------------------------------------------------
  521.   # draw_actor_param
  522.   #--------------------------------------------------------------------------
  523.   def draw_actor_param(param_id, dx, dy, dw)
  524.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  525.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  526.     contents.fill_rect(rect, colour)
  527.     change_color(system_color)
  528.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  529.     change_color(normal_color)
  530.     draw_text(dx+4, dy, dw-8, line_height, @actor.param(param_id).group, 2)
  531.   end
  532.  
  533.   #--------------------------------------------------------------------------
  534.   # draw_general_experience
  535.   #--------------------------------------------------------------------------
  536.   def draw_general_experience
  537.     if @actor.max_level?
  538.       s1 = @actor.exp.group
  539.       s2 = "-------"
  540.       s3 = "-------"
  541.     else
  542.       s1 = @actor.exp.group
  543.       s2 = (@actor.next_level_exp - @actor.exp).group
  544.       s3 = @actor.next_level_exp.group
  545.     end
  546.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  547.     total_next_text = sprintf(YEA::STATUS::NEXT_TOTAL_VOCAB, Vocab::level)
  548.     change_color(system_color)
  549.     dx = contents.width/2 + 12
  550.     dy = line_height * 3 / 2
  551.     dw = contents.width/2 - 36
  552.     draw_text(dx, dy + line_height * 0, dw, line_height, Vocab::ExpTotal)
  553.     draw_text(dx, dy + line_height * 2, dw, line_height, s_next)
  554.     draw_text(dx, dy + line_height * 4, dw, line_height, total_next_text)
  555.     change_color(normal_color)
  556.     draw_text(dx, dy + line_height * 1, dw, line_height, s1, 2)
  557.     draw_text(dx, dy + line_height * 3, dw, line_height, s2, 2)
  558.     draw_text(dx, dy + line_height * 5, dw, line_height, s3, 2)
  559.   end
  560.  
  561.   #--------------------------------------------------------------------------
  562.   # draw_parameter_graph
  563.   #--------------------------------------------------------------------------
  564.   def draw_parameter_graph
  565.     draw_parameter_title
  566.     dy = line_height * 3/2
  567.     maximum = 1
  568.     minimum = @actor.param_max(2)
  569.     for i in 2..7
  570.       maximum = [@actor.param(i), maximum].max
  571.       minimum = [@actor.param(i), minimum].min
  572.     end
  573.     maximum += minimum * 0.33 unless maximum == minimum
  574.     for i in 2..7
  575.       rate = calculate_rate(maximum, minimum, i)
  576.       dy = line_height * i - line_height/2
  577.       draw_param_gauge(i, dy, rate)
  578.       change_color(system_color)
  579.       draw_text(28, dy, contents.width - 56, line_height, Vocab::param(i))
  580.       dw = (contents.width - 48) * rate - 8
  581.       change_color(normal_color)
  582.       draw_text(28, dy, dw, line_height, @actor.param(i).group, 2)
  583.     end
  584.   end
  585.  
  586.   #--------------------------------------------------------------------------
  587.   # calculate_rate
  588.   #--------------------------------------------------------------------------
  589.   def calculate_rate(maximum, minimum, param_id)
  590.     return 1.0 if maximum == minimum
  591.     rate = (@actor.param(param_id).to_f - minimum) / (maximum - minimum).to_f
  592.     rate *= 0.67
  593.     rate += 0.33
  594.     return rate
  595.   end
  596.  
  597.   #--------------------------------------------------------------------------
  598.   # draw_param_gauge
  599.   #--------------------------------------------------------------------------
  600.   def draw_param_gauge(param_id, dy, rate)
  601.     dw = contents.width - 48
  602.     colour1 = param_gauge1(param_id)
  603.     colour2 = param_gauge2(param_id)
  604.     draw_gauge(24, dy, dw, rate, colour1, colour2)
  605.   end
  606.  
  607.   #--------------------------------------------------------------------------
  608.   # param_gauge1
  609.   #--------------------------------------------------------------------------
  610.   def param_gauge1(param_id)
  611.     return YEA::STATUS::PARAM_COLOUR[param_id][1]
  612.   end
  613.  
  614.   #--------------------------------------------------------------------------
  615.   # param_gauge2
  616.   #--------------------------------------------------------------------------
  617.   def param_gauge2(param_id)
  618.     return YEA::STATUS::PARAM_COLOUR[param_id][2]
  619.   end
  620.  
  621.   #--------------------------------------------------------------------------
  622.   # draw_parameter_title
  623.   #--------------------------------------------------------------------------
  624.   def draw_parameter_title
  625.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  626.     rect = Rect.new(0, 0, contents.width, contents.height)
  627.     contents.fill_rect(rect, colour)
  628.     change_color(system_color)
  629.     text = YEA::STATUS::PARAMETERS_VOCAB
  630.     draw_text(0, line_height/3, contents.width, line_height, text, 1)
  631.   end
  632.  
  633.   #--------------------------------------------------------------------------
  634.   # draw_properties_list
  635.   #--------------------------------------------------------------------------
  636.   def draw_properties_list
  637.     contents.font.size = YEA::STATUS::PROPERTIES_FONT_SIZE
  638.     draw_properties_column1
  639.     draw_properties_column2
  640.     draw_properties_column3
  641.     reset_font_settings
  642.   end
  643.  
  644.   #--------------------------------------------------------------------------
  645.   # draw_properties_column1
  646.   #--------------------------------------------------------------------------
  647.   def draw_properties_column1
  648.     dx = 24
  649.     dw = (contents.width - 24) / 3 - 24
  650.     dy = 0
  651.     for property in YEA::STATUS::PROPERTIES_COLUMN1
  652.       dy = draw_property(property, dx, dy, dw)
  653.     end
  654.   end
  655.  
  656.   #--------------------------------------------------------------------------
  657.   # draw_properties_column2
  658.   #--------------------------------------------------------------------------
  659.   def draw_properties_column2
  660.     dx = 24 + (contents.width - 24) / 3
  661.     dw = (contents.width - 24) / 3 - 24
  662.     dy = 0
  663.     for property in YEA::STATUS::PROPERTIES_COLUMN2
  664.       dy = draw_property(property, dx, dy, dw)
  665.     end
  666.   end
  667.  
  668.   #--------------------------------------------------------------------------
  669.   # draw_properties_column3
  670.   #--------------------------------------------------------------------------
  671.   def draw_properties_column3
  672.     dx = 24 + (contents.width - 24) / 3 * 2
  673.     dw = (contents.width - 24) / 3 - 24
  674.     dy = 0
  675.     for property in YEA::STATUS::PROPERTIES_COLUMN3
  676.       dy = draw_property(property, dx, dy, dw)
  677.     end
  678.   end
  679.  
  680.   #--------------------------------------------------------------------------
  681.   # draw_property
  682.   #--------------------------------------------------------------------------
  683.   def draw_property(property, dx, dy, dw)
  684.     fmt = "%1.2f%%"
  685.     case property[0]
  686.     #---
  687.     when :hit
  688.       value = sprintf(fmt, @actor.hit * 100)
  689.     when :eva
  690.       value = sprintf(fmt, @actor.eva * 100)
  691.     when :cri
  692.       value = sprintf(fmt, @actor.cri * 100)
  693.     when :cev
  694.       value = sprintf(fmt, @actor.cev * 100)
  695.     when :mev
  696.       value = sprintf(fmt, @actor.mev * 100)
  697.     when :mrf
  698.       value = sprintf(fmt, @actor.mrf * 100)
  699.     when :cnt
  700.       value = sprintf(fmt, @actor.cnt * 100)
  701.     when :hrg
  702.       value = sprintf(fmt, @actor.hrg * 100)
  703.     when :mrg
  704.       value = sprintf(fmt, @actor.mrg * 100)
  705.     when :trg
  706.       value = sprintf(fmt, @actor.trg * 100)
  707.     when :tgr
  708.       value = sprintf(fmt, @actor.tgr * 100)
  709.     when :grd
  710.       value = sprintf(fmt, @actor.grd * 100)
  711.     when :rec
  712.       value = sprintf(fmt, @actor.rec * 100)
  713.     when :pha
  714.       value = sprintf(fmt, @actor.pha * 100)
  715.     when :mcr
  716.       value = sprintf(fmt, @actor.mcr * 100)
  717.     when :tcr
  718.       value = sprintf(fmt, @actor.tcr * 100)
  719.     when :pdr
  720.       value = sprintf(fmt, @actor.pdr * 100)
  721.     when :mdr
  722.       value = sprintf(fmt, @actor.mdr * 100)
  723.     when :fdr
  724.       value = sprintf(fmt, @actor.fdr * 100)
  725.     when :exr
  726.       value = sprintf(fmt, @actor.exr * 100)
  727.     when :hcr
  728.       return dy unless $imported["YEA-SkillCostManager"]
  729.       value = sprintf(fmt, @actor.hcr * 100)
  730.     when :tcr
  731.       return dy unless $imported["YEA-SkillCostManager"]
  732.       value = sprintf(fmt, @actor.tcr * 100)
  733.     when :gcr
  734.       return dy unless $imported["YEA-SkillCostManager"]
  735.       value = sprintf(fmt, @actor.gcr * 100)
  736.     when :cdr
  737.       return dy unless $imported["YEA-SkillRestrictions"]
  738.       value = sprintf(fmt, @actor.cdr * 100)
  739.     when :wur
  740.       return dy unless $imported["YEA-SkillRestrictions"]
  741.       value = sprintf(fmt, @actor.wur * 100)
  742.     #---
  743.     else; return dy
  744.     end
  745.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  746.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  747.     contents.fill_rect(rect, colour)
  748.     change_color(system_color)
  749.     draw_text(dx+4, dy, dw-8, line_height, property[1], 0)
  750.     change_color(normal_color)
  751.     draw_text(dx+4, dy, dw-8, line_height, value, 2)
  752.     return dy + line_height
  753.   end
  754.  
  755.   #--------------------------------------------------------------------------
  756.   # draw_actor_biography
  757.   #--------------------------------------------------------------------------
  758.   def draw_actor_biography
  759.     fmt = YEA::STATUS::BIOGRAPHY_NICKNAME_TEXT
  760.     text = sprintf(fmt, @actor.name, @actor.nickname)
  761.     contents.font.size = YEA::STATUS::BIOGRAPHY_NICKNAME_SIZE
  762.     draw_text(0, 0, contents.width, line_height*2, text, 1)
  763.     reset_font_settings
  764.     draw_text_ex(24, line_height*2, @actor.description)
  765.   end
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # draw_custom
  769.   #--------------------------------------------------------------------------
  770.   def draw_custom
  771.     current_symbol = @command_window.current_symbol
  772.     return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(current_symbol)
  773.     method(YEA::STATUS::CUSTOM_STATUS_COMMANDS[current_symbol][3]).call
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # draw_custom1
  778.   #--------------------------------------------------------------------------
  779.   def draw_custom1
  780.     dx = 0; dy = 0
  781.     for skill in @actor.skills
  782.       next if skill.nil?
  783.       next unless @actor.added_skill_types.include?(skill.stype_id)
  784.       draw_item_name(skill, dx, dy)
  785.       dx = dx == contents.width / 2 + 16 ? 0 : contents.width / 2 + 16
  786.       dy += line_height if dx == 0
  787.       return if dy + line_height > contents.height
  788.     end
  789.   end
  790.  
  791.   #--------------------------------------------------------------------------
  792.   # draw_custom2
  793.   #--------------------------------------------------------------------------
  794.   def draw_custom2
  795.     dx = 4; dy = 0; slot_id = 0
  796.     for equip in @actor.equips
  797.       change_color(system_color)
  798.       text = Vocab.etype(@actor.equip_slots[slot_id])
  799.       draw_text(dx, dy, contents.width - dx, line_height, text)
  800.       reset_font_settings
  801.       draw_item_name(equip, dx+92, dy) unless equip.nil?
  802.       slot_id += 1
  803.       dy += line_height
  804.       break if dy + line_height > contents.height
  805.     end
  806.     dw = Graphics.width * 2 / 5 - 24
  807.     dx = contents.width - dw; dy = 0
  808.     param_id = 0
  809.     8.times do
  810.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  811.       rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  812.       contents.fill_rect(rect, colour)
  813.       size = $imported["YEA-AceEquipEngine"] ? YEA::EQUIP::STATUS_FONT_SIZE : 20
  814.       contents.font.size = size
  815.       change_color(system_color)
  816.       draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
  817.       change_color(normal_color)
  818.       dwa = (Graphics.width * 2 / 5 - 2) / 2
  819.       draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
  820.       reset_font_settings
  821.       change_color(system_color)
  822.       draw_text(dx + dwa, dy, 22, line_height, "→", 1)
  823.       param_id += 1
  824.       dy += line_height
  825.       break if dy + line_height > contents.height
  826.     end
  827.   end
  828.  
  829.   #--------------------------------------------------------------------------
  830.   # draw_custom3
  831.   #--------------------------------------------------------------------------
  832.   def draw_custom3
  833.     return unless $imported["YEA-ClassSystem"]
  834.     data = []
  835.     for class_id in YEA::CLASS_SYSTEM::CLASS_ORDER
  836.       next if $data_classes[class_id].nil?
  837.       item = $data_classes[class_id]
  838.       next unless @actor.unlocked_classes.include?(item.id) or
  839.         YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS.include?(item.id)
  840.       data.push(item)
  841.     end
  842.     dx = 0; dy = 0; class_index = 0
  843.     for class_id in data
  844.       item = data[class_index]
  845.       reset_font_settings
  846.       if item == @actor.class
  847.         change_color(text_color(YEA::CLASS_SYSTEM::CURRENT_CLASS_COLOUR))
  848.       elsif item == @actor.subclass
  849.         change_color(text_color(YEA::CLASS_SYSTEM::SUBCLASS_COLOUR))
  850.       else
  851.         change_color(normal_color)
  852.       end
  853.       icon = item.icon_index
  854.       draw_icon(icon, dx, dy)
  855.       text = item.name
  856.       draw_text(24, dy, contents.width-24, line_height, text)
  857.       next if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  858.       level = @actor.class_level(item.id)
  859.       contents.font.size = YEA::CLASS_SYSTEM::LEVEL_FONT_SIZE
  860.       text = sprintf(YEA::CLASS_SYSTEM::CLASS_LEVEL, level.group)
  861.       dwa = contents.width - (Graphics.width * 2 / 5 - 24) - 28
  862.       draw_text(dx, dy, dwa, line_height, text, 2)
  863.       class_index += 1
  864.       dy += line_height
  865.       break if dy + line_height > contents.height
  866.     end
  867.     dw = Graphics.width * 2 / 5 - 24
  868.     dx = contents.width - dw; dy = 0
  869.     param_id = 0
  870.     8.times do
  871.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  872.       rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  873.       contents.fill_rect(rect, colour)
  874.       contents.font.size = YEA::CLASS_SYSTEM::PARAM_FONT_SIZE
  875.       change_color(system_color)
  876.       draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
  877.       change_color(normal_color)
  878.       dwa = (Graphics.width * 2 / 5 - 2) / 2
  879.       draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
  880.       reset_font_settings
  881.       change_color(system_color)
  882.       draw_text(dx + dwa, dy, 22, line_height, "→", 1)
  883.       param_id += 1
  884.       dy += line_height
  885.       break if dy + line_height > contents.height
  886.     end
  887.   end
  888.  
  889. end # Window_StatusItem
  890.  
  891. #==============================================================================
  892. # ■ Scene_Status
  893. #==============================================================================
  894.  
  895. class Scene_Status < Scene_MenuBase
  896.  
  897.   #--------------------------------------------------------------------------
  898.   # start
  899.   #--------------------------------------------------------------------------
  900.   def start
  901.     super
  902.     create_help_window
  903.     create_command_window
  904.     create_status_window
  905.     create_item_window
  906.     relocate_windows
  907.   end
  908.  
  909.   #--------------------------------------------------------------------------
  910.   # create_command_window
  911.   #--------------------------------------------------------------------------
  912.   def create_command_window
  913.     wy = @help_window.height
  914.     @command_window = Window_StatusCommand.new(0, wy)
  915.     @command_window.viewport = @viewport
  916.     @command_window.actor = @actor
  917.     @command_window.help_window = @help_window
  918.     @command_window.set_handler(:cancel,   method(:return_scene))
  919.     @command_window.set_handler(:pagedown, method(:next_actor))
  920.     @command_window.set_handler(:pageup,   method(:prev_actor))
  921.     process_custom_status_commands
  922.   end
  923.  
  924.   #--------------------------------------------------------------------------
  925.   # process_custom_status_commands
  926.   #--------------------------------------------------------------------------
  927.   def process_custom_status_commands
  928.     for command in YEA::STATUS::COMMANDS
  929.       next unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
  930.       called_method = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][2]
  931.       @command_window.set_handler(command[0], method(called_method))
  932.     end
  933.   end
  934.  
  935.   #--------------------------------------------------------------------------
  936.   # create_status_window
  937.   #--------------------------------------------------------------------------
  938.   def create_status_window
  939.     wy = @help_window.height
  940.     @status_window = Window_StatusActor.new(@command_window.width, wy)
  941.     @status_window.viewport = @viewport
  942.     @status_window.actor = @actor
  943.   end
  944.  
  945.   #--------------------------------------------------------------------------
  946.   # create_item_window
  947.   #--------------------------------------------------------------------------
  948.   def create_item_window
  949.     dy = @command_window.y + @command_window.height
  950.     @item_window = Window_StatusItem.new(0, dy, @command_window)
  951.     @item_window.viewport = @viewport
  952.     @item_window.actor = @actor
  953.     @command_window.item_window = @item_window
  954.   end
  955.  
  956.   #--------------------------------------------------------------------------
  957.   # relocate_windows
  958.   #--------------------------------------------------------------------------
  959.   def relocate_windows
  960.     return unless $imported["YEA-AceMenuEngine"]
  961.     case Menu.help_window_location
  962.     when 0 # Top
  963.       @help_window.y = 0
  964.       @command_window.y = @help_window.height
  965.       @item_window.y = @command_window.y + @command_window.height
  966.     when 1 # Middle
  967.       @command_window.y = 0
  968.       @help_window.y = @command_window.height
  969.       @item_window.y = @help_window.y + @help_window.height
  970.     else # Bottom
  971.       @command_window.y = 0
  972.       @item_window.y = @command_window.height
  973.       @help_window.y = @item_window.y + @item_window.height
  974.     end
  975.     @status_window.y = @command_window.y
  976.   end
  977.  
  978.   #--------------------------------------------------------------------------
  979.   # on_actor_change
  980.   #--------------------------------------------------------------------------
  981.   def on_actor_change
  982.     @command_window.actor = @actor
  983.     @status_window.actor = @actor
  984.     @item_window.actor = @actor
  985.     @command_window.activate
  986.   end
  987.  
  988.   #--------------------------------------------------------------------------
  989.   # new method: command_name1
  990.   #--------------------------------------------------------------------------
  991.   def command_name1
  992.     SceneManager.call(Scene_Skill)
  993.   end
  994.  
  995.   #--------------------------------------------------------------------------
  996.   # new method: command_name2
  997.   #--------------------------------------------------------------------------
  998.   def command_name2
  999.     SceneManager.call(Scene_Equip)
  1000.   end
  1001.  
  1002.   #--------------------------------------------------------------------------
  1003.   # new method: command_name3
  1004.   #--------------------------------------------------------------------------
  1005.   def command_name3
  1006.     unless $imported["YEA-ClassSystem"]
  1007.       @command_window.activate
  1008.       return
  1009.     end
  1010.     SceneManager.call(Scene_Class)
  1011.   end
  1012.  
  1013. end # Scene_Status
  1014.  
  1015. #==============================================================================
  1016. #
  1017. # ▼ End of File
  1018. #
  1019. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement