Advertisement
Bigace360

Actor Biography [VXAce]

Apr 23rd, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 18.42 KB | None | 0 0
  1. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  2. # ■ Actor Biography                      
  3. # ■ Author: Bigace360  
  4. # ■ Version: 1.00
  5. # ■ Date: April 23, 2013
  6. # ■ Blog: http://bigaceworld.wordpress.com/
  7. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  8. #                               VERSION HISTORY                                #
  9. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  10. # v1.00 (04.23.2013) - Started and Finished
  11. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  12. #                                INTRODUCTION                                  #
  13. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  14. # This is a script that calls a window that displays different aspects about a
  15. # character… like their age, height, gender etc. These can be changed though.
  16. # Along with that, the script allows for the ability to change the descriptions
  17. # for actors during the game.
  18. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  19. #                                INSTRUCTIONS                                  #
  20. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  21. # To instal the script, open you script editor and paste this script on a new
  22. # section bellow the Materials section. If you are using a menu script and you
  23. # want this script to add itself to the menu automatically, then this script
  24. # should be below the custom menu. The actor's portrait images must be placed
  25. # on the folder "Graphics/portraits/". Create a folder named "Portraits" in the
  26. # Graphics folder.
  27. #
  28. #------------------------------------------------------------------------------
  29. # The scene can be called in an event using the following script call:
  30. #    call_biography
  31. #
  32. #------------------------------------------------------------------------------
  33. # Comment calls note tags:
  34. #  Tags to be used in events comment box, works like a script call.
  35. #
  36. #  <change biography: id>
  37. #  string
  38. #  </change biography>
  39. #   The new description text, the string is the text, to add a break line
  40. #   use \\n.
  41. #     id : ID of the actor
  42. #
  43. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  44. #                                  SECTIONS                                    #
  45. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  46. #  ■ Modules
  47. # ** Module ACE
  48. #
  49. #  ■ RPGXP Data Structures
  50. # ** Object
  51. # ** Bitmap
  52. # ** Module Cache
  53. #
  54. #  ■ Game_Objects
  55. # ** Game_System
  56. # ** Game_Actor
  57. # ** Game_Interpreter
  58. #
  59. #  ■ Windows
  60. # ** Window_MenuCommand
  61. # ** Window_Biography
  62. #
  63. #  ■ Scenes
  64. # ** Scene_Menu
  65. # ** Scene_Biography
  66. #
  67. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  68. #
  69. # Credits/Thanks:
  70. #   - Bigace360, for the script.
  71. #   - Blizzard (Bitmap.Slice_text method)
  72. #
  73. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  74. #                     Script Conflicts and Compatability                       #
  75. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  76. # * Overwrite methods
  77. #   class Game_Actor < Game_Battler
  78. #     def description
  79. #
  80. # * Alias methods
  81. #   class Game_Interpreter
  82. #     def command_108
  83. #
  84. #   class Window_MenuCommand < Window_Command
  85. #     def make_command_list
  86. #
  87. #   class Scene_Menu < Scene_MenuBase
  88. #     def create_command_window(*args, &block)
  89. #     def on_personal_ok(*args, &block)
  90. #
  91. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  92. #
  93. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  94. # ■ Module ACE::CORE
  95. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  96. module ACE 
  97.   module CORE
  98.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  99.         # ◆ Section I. General Settings◆
  100.         # -------------------------------------------------------------------------
  101.         # This changes the way menus appear in your game.
  102.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  103.         BIO_CONFIG ={
  104.             # :menu_access - This value determines whether the Biography is accessible
  105.             # from a command in the menu. If true, then it is. If false, it isn't.      
  106.             :menu_access => true,
  107.             # :menu_index - If :menu_access is true, then this value determines where
  108.             # in the menu command window it is inserted.
  109.             :menu_index => 4,
  110.             # :menu_label - If :menu_access is true, then this value determines the
  111.             # name of the command in the menu
  112.             :menu_label => 'Biography',
  113.     }
  114.        
  115.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  116.         # ◆ Section II. Biography Settings ◆
  117.         # -------------------------------------------------------------------------
  118.         # The following will allow you to adjust biographies for actors.
  119.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  120.         BIOGRAPHY ={
  121.             # :portrait - large image of the selected actor, you can choose it's x y
  122.       # coordinates from here.
  123.             #              [X,   Y  ]
  124.             :portrait => [300, 545],
  125.             # :y_coordinates - Y Coordinates for the History and Bio Paragraphs
  126.             #                 [His.y, Bio.y]
  127.             :y_coordinates => [5, 200],
  128.             # Alignment for enemies biography and battle tactics:
  129.             # 0=right;
  130.             # 1=center;
  131.             # 2=left
  132.             :alignment => 0,   
  133.             # :character_stats - Change the characters stat values in the array to
  134.             # whatever you want.
  135.             :character_stats => [
  136.                 'Name:',
  137.                 'Class:',
  138.         'Nicknames:',
  139.                 'Age:',
  140.                 'Gender:',
  141.                 'Race:',
  142.                 'Height:',
  143.                 'Weight:',
  144.                 'Weapon:',
  145.                 'From:',
  146.                 'Speciality:',
  147.             ],
  148.             # :character_info - Configure the values used for the above array for each
  149.             # character. Just make sure the value that corresponds to each stat is at
  150.             # the same index in the array.
  151.             #-------------------------------------------------------------------------
  152.             # Note that special characters like a " (double quote) need the use of the
  153.             # escape character \ (backslash). If you get and error with your string or
  154.             # the character doesn't appear right on the screen, try to use the escape
  155.             # character (i.e. for a " it would be \" instead of just "). The backslash
  156.             # itself needs an escape character (i.e. \\). Also use \\N[x] to write out
  157.             # the actor's first name if the game allows renaming.
  158.             :character_info => {
  159.                 # char_id => [character_stats,....],
  160.                 1 => ['\\N[1] Smith', '\\C[1]', '\\A[1]', '19', 'Male', 'Human', '5\'10"',
  161.  
  162. '165 lbs.', 'Sword','England', 'Swordplay'],
  163.                 2 => ['\\N[2] Doe', '\\C[2]', '\\A[2]', '24', 'Male', 'Human', '6\'0"',
  164.  
  165. '169 lbs.', 'Spear', 'America', 'Lanceplay'],
  166.                 3 => ['\\N[3] Ray', '\\C[3]', '\\A[3]', '21', 'Male', 'Human', '5\'7"',
  167.  
  168. '197 lbs.', 'Axes', 'New Zealand','Axeplay'],
  169.                 4 => ['\\N[4] Griffen', '\\C[4]', '\\A[4]', '19', 'Female', 'Human',
  170.  
  171. '5\'7"', '119 lbs.', 'Knives', 'Canada', 'Robbery'],
  172.                 5 => ['\\N[5] Green', '\\C[5]', '\\A[5]', '16', 'Female', 'Elf', '5\'8"',
  173.  
  174. '116 lbs.', 'Great Bows', 'Ireland', 'Archery'],
  175.                 6 => ['\\N[6] Clarke', '\\C[6]', '\\A[6]', '20', 'Male', 'Human', '5\'7"',
  176.  
  177. '135 lbs.', 'Guns', 'France', 'Gunnery'],
  178.                 7 => ['\\N[7] Clarke','\\C[7]', '\\A[7]', '18', 'Female', 'Human', '5\'4"',
  179.  
  180. '119 lbs.', 'Wands', 'Germany', 'White magic'],
  181.                 8 => ['\\N[8] May', '\\C[8]', '\\A[8]', '20', 'Female', 'Human', '5\'5"',
  182.  
  183. '113 lbs.', 'Staff', 'Berlin', 'Black Magic'],
  184.             },
  185.             # The header for the actors biography and history
  186.             :headers => ['BIOGRAPHY:', 'HISTORY:'],
  187.         }
  188.        
  189.         # Short paragraph/description of character. When typing out biographies
  190.         # and descriptions, use \\N[x] to write out the actor's first name if the
  191.         # game allows renaming. For line splits, the script uses Blizzard's
  192.         # slice_text  method to automatically break to next line when needed, so do
  193.         # not concern yourself with that.
  194.         def self.character_history(id)
  195.             text = case id
  196.             when 1 then '\\N[1] is RMVXA\'s hero and the main protagonist. He is a 19 ' +
  197.                 'year-old orphaned human street urchin who lost his parents in a plague ' +
  198.                 'when he was 12 years old. His only brother, died two years before the ' +
  199.                 'start of the game, during the Zombie invasion.'   
  200.             end
  201.             return !text.nil? ? text : 'No Information Available'
  202.         end
  203.   end
  204. end
  205.  
  206. #●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
  207. # * BEGIN [ DON'T TOUCH THIS SECTION ]
  208. #●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
  209. #
  210. # ▼ Warning
  211. # Editting anything past this point may potentially result in causing
  212. # computer damage, incontinence, explosion of user's head, coma, death,
  213. # and/or halitosis so edit at your own risk.
  214. #
  215. #●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
  216. #
  217. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  218. #                         ▼ Import to Global Hash ▼                            #
  219. ($ace_script ||= {})[:actor_biography] = 1.00
  220. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  221.  
  222. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  223. # ■ Object (This class is the superclass of all other classes.)
  224. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  225. class Object
  226.   def get_all_values(value1, value2 = nil)
  227.     value2 = value1 unless value2
  228.     /<#{value1}>((?:[^<]|<[^\/])*)<\/#{value2}>/im
  229.   end
  230. end
  231.  
  232. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  233. # ■ Bitmap (The bitmap class. Bitmaps are expressions of so-called graphics.)
  234. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  235. class Bitmap
  236.     #------------(slice_text method by Blizzard)-------
  237.     def slice_text(text, width)
  238.         lines = text.split("\n")
  239.         result = []
  240.         lines.each do |text_chunk|
  241.             words = text_chunk.split(' ')
  242.             current_text = words.shift
  243.       next result << (current_text.nil? ? "" : current_text) if words.empty?
  244.             words.each_index do |i|
  245.                 if self.text_size("#{current_text} #{words[i]}").width > width
  246.                     result.push(current_text)
  247.                     current_text = words[i]
  248.                 else
  249.                     current_text = "#{current_text} #{words[i]}"
  250.                 end
  251.                 result << current_text if i >= words.size - 1
  252.             end
  253.         end
  254.         return result
  255.     end
  256. end
  257.  
  258. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  259. # ■ Module Cache
  260. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  261. module Cache
  262.   def self.portrait(filename)
  263.         load_bitmap("Graphics/portraits/", filename)
  264.   end
  265. end
  266.  
  267. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  268. # ■ Game_Actor
  269. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  270. class Game_Actor < Game_Battler
  271.   def description
  272.     @description ? @description : actor.description
  273.   end
  274.   def description=(n)
  275.     @description = n
  276.   end  
  277. end
  278.  
  279. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  280. # ■ Game_Interpreter
  281. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  282. class Game_Interpreter
  283.   alias :ace_biography_command_108 :command_108 unless $@
  284.   def command_108
  285.     ace_biography_command_108
  286.     call_bio_description
  287.   end
  288.   def call_bio_description
  289.     value  = "CHANGE BIOGRAPHY"
  290.     regexp = get_all_values("#{value}: (\\d+)", value)
  291.     note.scan(regexp) do |id, text|
  292.       text.gsub!(/\r\n/) {""}
  293.       text.gsub!(/\\n/)  {"\r\n"}
  294.       $game_actors[id.to_i].description = text if $game_actors[id.to_i]
  295.     end
  296.   end
  297.     def note
  298.         @comments ? @comments.join("\r\n") : ""
  299.     end
  300.   def call_biography
  301.         SceneManager.call(Scene_Biography)
  302.     end    
  303. end
  304.  
  305. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  306. # ■ Window_Biography
  307. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  308. class Window_Biography < Window_Selectable
  309.     include ACE::CORE
  310.   def initialize(actor)
  311.     super(0, 0, Graphics.width, Graphics.height)
  312.     @actor = actor; @bio = BIOGRAPHY
  313.     refresh
  314.     activate
  315.   end
  316.     def actor=(actor)
  317.         return if @actor == actor
  318.         @actor = actor
  319.         refresh
  320.     end
  321.   def refresh
  322.         contents.clear
  323.         draw_actor_portrait(@actor, @bio[:portrait][0], @bio[:portrait][1])
  324.         stats = @bio[:character_stats]; @align = @bio[:alignment]  
  325.         @bio_y = @bio[:y_coordinates][0]; @his_y = @bio[:y_coordinates][1]
  326.         contents.font.size = 16
  327.         draw_header(stats)
  328.         reset_font_settings
  329.         contents.font.size = 16
  330.     draw_actors_persona
  331.         contents.font.size = 20
  332.     draw_actors_bio; draw_actors_history
  333.   end
  334.     def draw_header(stats)
  335.         change_color(system_color); contents.font.bold = true
  336.         stats.each_index {|i| draw_text(0, i*(17*2), 168, 24, stats[i])}
  337.         draw_text(200, @bio_y, 168, 24, @bio[:headers][0])
  338.         draw_text(200, @his_y, 168, 24, @bio[:headers][1])     
  339.   end
  340.     def draw_actors_persona
  341.         info = @bio[:character_info][@actor.id]
  342.         info.join(" ")
  343.         info.each do |i|
  344.       i.gsub!(/\\[Nn]\[([0-9]+)\]/) {actor_name($1.to_i)}
  345.       i.gsub!(/\\[Cc]\[([0-9]+)\]/) {actor_class($1.to_i)}
  346.       i.gsub!(/\\[Aa]\[([0-9]+)\]/) {actor_nickname($1.to_i)}
  347.     end
  348.         info.each_with_index {|i, y| draw_text(8, 17+y*(17*2), 168, 24, i)}
  349.     end
  350.   def actor_class(n)
  351.     actor = n >= 1 ? $game_actors[n] : nil
  352.     actor ? actor.class.name : ""
  353.   end
  354.   def actor_nickname(n)
  355.     actor = n >= 1 ? $game_actors[n] : nil
  356.     actor ? actor.nickname : ""    
  357.   end
  358.     def draw_actors_bio
  359.     text = @actor.description
  360.     text = convert_escape_characters(text)
  361.         bio = contents.slice_text(text, 310)
  362.         bio.each_index do |i|
  363.             draw_text(210, ((@bio_y+5)+20)+i*20, 310, 24, bio[i], @align)
  364.         end    
  365.     end
  366.     def draw_actors_history
  367.         text = ACE::CORE.character_history(@actor.id)
  368.     text = convert_escape_characters(text)
  369.         his = contents.slice_text(text, 310)
  370.         his.each_index do |i|
  371.             draw_text(210, ((@his_y+5)+20)+i*20, 310, 24, his[i], @align)
  372.         end    
  373.     end
  374.   def draw_actor_portrait(filename, x, y)
  375.         bitmap = Cache.portrait("#{actor.name}_P") rescue Cache.portrait("")
  376.         cw = bitmap.width
  377.         ch = bitmap.height
  378.         src_rect = Rect.new(0, 0, cw, ch)
  379.         self.contents.blt(x, y, bitmap, src_rect, 98)
  380.         bitmap.dispose
  381.   end
  382. end
  383.  
  384. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  385. # ■ Scene_Biography
  386. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  387. class Scene_Biography < Scene_MenuBase
  388.   def start
  389.     super
  390.     @status_window = Window_Biography.new(@actor)
  391.     @status_window.set_handler(:cancel,   method(:return_scene))
  392.     @status_window.set_handler(:pagedown, method(:next_actor))
  393.     @status_window.set_handler(:pageup,   method(:prev_actor))
  394.   end
  395.   def on_actor_change
  396.     @status_window.actor = @actor
  397.     @status_window.activate
  398.   end
  399. end
  400.  
  401. if ACE::CORE::BIO_CONFIG[:menu_access]
  402.   ACE_COMMAND_INSERTS = {}
  403.   ACE_InsertableMenuCommand = Struct.new(:name, :index, :enable, :scene, :other)
  404.     #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  405.   # ■ Game_System
  406.   #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  407.   class Game_System
  408.         def ace_inserted_menu_commands
  409.             if !@ace_inserted_menu_commands
  410.                 @ace_inserted_menu_commands = ACE_COMMAND_INSERTS.keys
  411.                 @ace_inserted_menu_commands.sort! do |a, b|
  412.           ACE_COMMAND_INSERTS[a].index <=> ACE_COMMAND_INSERTS[b].index
  413.         end
  414.             end
  415.             @ace_inserted_menu_commands
  416.         end
  417.   end
  418.     #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  419.   # ■ Window_MenuCommand
  420.   #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  421.     class Window_MenuCommand
  422.         alias :ace_command_bio_insert :make_command_list unless $@
  423.         def make_command_list(*args, &block)
  424.             ace_command_bio_insert(*args, &block)
  425.             $game_system.ace_inserted_menu_commands.each do |sym|
  426.         ace_insert_command(sym)
  427.       end
  428.         end
  429.         def ace_insert_command(symbol)
  430.             command = ACE_COMMAND_INSERTS[symbol]
  431.             name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
  432.             enabled = case command.enable
  433.             when Integer then command.enable == 0 ? true : $game_switches[command.enable]
  434.             when String then eval(command.enable)
  435.             when Symbol then self.send(command.enable)
  436.             else enabled = true
  437.             end
  438.             add_command(name, symbol, enabled)
  439.             added = @list.pop
  440.             @list.insert([command.index, @list.size].min, added)
  441.     end
  442.   end
  443.     #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  444.   # ■ Scene_Menu
  445.   #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  446.   class Scene_Menu
  447.         alias :ace_create_bio_window :create_command_window
  448.         alias :ace_personal_bio_ok :on_personal_ok
  449.         def create_command_window(*args, &block)
  450.             ace_create_bio_window(*args, &block)
  451.             $game_system.ace_inserted_menu_commands.each do |symbol|
  452.         ace_set_insert_handler(symbol)
  453.       end
  454.         end
  455.         def ace_set_insert_handler(symbol)
  456.             other = ACE_COMMAND_INSERTS[symbol].other
  457.             handler = case other
  458.             when Symbol then method(other)
  459.             when String then lambda { eval(other) }
  460.             when TrueClass then method(:command_personal)
  461.             else method(:ace_command_insert)
  462.             end
  463.             @command_window.set_handler(symbol, handler)
  464.         end
  465.         def ace_command_insert
  466.             SceneManager.call(Kernel.const_get(
  467.         ACE_COMMAND_INSERTS[@command_window.current_symbol].scene)
  468.       )
  469.         end
  470.         def on_personal_ok(*args, &block)
  471.             if $game_system.maic_inserted_menu_commands.include?
  472.  
  473. (@command_window.current_symbol)
  474.                 ace_command_insert
  475.             else
  476.                 ace_personal_bio_ok(*args, &block)
  477.             end
  478.         end
  479.     end
  480.     ACE_COMMAND_INSERTS[:stateview] = ACE_InsertableMenuCommand.new(
  481.         ACE::CORE::BIO_CONFIG[:menu_label],
  482.     ACE::CORE::BIO_CONFIG[:menu_index], true, :Scene_Biography, false)
  483. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement