Advertisement
roninator2

CSCA Encyclopedia addon - Custom notes mod

Dec 7th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.58 KB | None | 0 0
  1. =begin
  2. CSCA Encyclopedia
  3. version: 3.0.3 (Released: March 7, 2013)
  4. Created by: Casper Gaming (http://www.caspergaming.com/)
  5.  
  6. ## Modded by Roninator2
  7.  
  8. ##    Custom note for encyclopedia items now
  9. ##    use the following:
  10. ##    <cscanote>
  11.       Your Text Here
  12.       with more text
  13.  
  14.       tada
  15. ##    </cscanote>
  16. ##  
  17. ##    all the text inside will be displayed for the note description
  18. ##
  19. ##    fixed the press action button position for 640x480 screen
  20.  
  21. =end
  22.  
  23. class Scene_CSCA_Encyclopedia < Scene_MenuBase
  24.   def start
  25.     super
  26.     create_command_window
  27.     create_dummy_window
  28.     create_csca_info_window
  29.     create_specific_total_window
  30.     create_csca_list_window
  31.     create_total_window
  32.   end
  33.   def create_command_window
  34.     @command_window = CSCA_Window_EncyclopediaMainSelect.new(0, 0)
  35.     @command_window.viewport = @viewport
  36.     @command_window.set_handler(:ok,     method(:on_category_ok))
  37.     @command_window.set_handler(:cancel, method(:return_scene))
  38.   end
  39.   def create_specific_total_window
  40.     wy = @csca_info_window.height - @command_window.height
  41.     wh = @command_window.height
  42.     wl = @dummy_window.width - 80
  43.     @specific_total_window = CSCA_Window_EncyclopediaSpecificTotal.new(0, wy, wl, wh)
  44.     @specific_total_window.viewport = @viewport
  45.     @command_window.csca_specific_total_window = @specific_total_window
  46.   end
  47.  
  48.   def create_total_window
  49.     wy = @csca_list_window.y + @csca_list_window.height + @specific_total_window.height
  50.     wh = @command_window.height
  51.     wl = @csca_list_window.width
  52.     @total_window = CSCA_Window_EncyclopediaTotal.new(0, wy, wl, wh)
  53.     @total_window.viewport = @viewport
  54.   end
  55. end
  56.  
  57. class CSCA_Window_EncyclopediaInfo < Window_Base
  58.   def notes
  59.     @item.effect_desc
  60.   end
  61.  
  62.   def csca_draw_custom_note(x,y,width,height,item)
  63.     @item = item
  64.     contents.font.size = 20
  65.     change_color(system_color)
  66.     draw_text(x,y,width,height,"Note: ")
  67.     change_color(normal_color)
  68.     notes.each do |l|
  69.       draw_text(x+45, y, contents.width, line_height, l)
  70.       y += line_height
  71.     end
  72.   end
  73.   def csca_draw_toggle_tutorial
  74.     contents.font.size = 16
  75.     draw_text(0,380,contents.width,line_height,CSCA_ENCYCLOPEDIA::TRIGGER_TEXT,1)
  76.   end
  77. end
  78.  
  79. class RPG::BaseItem
  80.   def effect_desc
  81.     make_effect_desc if @effect_desc.nil?
  82.     return @effect_desc
  83.   end
  84.  
  85.   def make_effect_desc
  86.     @effect_desc = []
  87.     results = self.note.scan(/<cscanote>(.*?)<\/cscanote>/imx)
  88.     results.each do |res|
  89.       res[0].strip.split("\r\n").each do |line|
  90.       @effect_desc.push("#{line}")
  91.       end
  92.     end
  93.   end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement