Advertisement
Zetu

SSSII

May 24th, 2011
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.20 KB | None | 0 0
  1. #=========================================================================#
  2. # Side-slot Style II  v1.01                                               #
  3. # * THIS ADD-ON REQUIRES the Script "Z-Systems Neo Menu System" by Zetu * #
  4. #=========================================================================#
  5. module Z_Systems
  6.   module NeoMenu
  7.     module SSSII
  8.       ACTORS = 1..8 # Index of all actors to be shown in menu.  Max 8.
  9.       #Actor IMG A size = 128 * 96
  10.       #Actor IMG B size = 128 * 80
  11.     end
  12.   end
  13. end
  14.  
  15. class Game_Actor < Game_Battler
  16.   def exp_til
  17.     return (@exp - @exp_list[@level])
  18.   end
  19.   def exp_max
  20.     return 0 if @level == 99
  21.     return @exp_list[@level+1] - @exp_list[@level]
  22.   end
  23. end
  24.  
  25. class Window_Base < Window
  26.  
  27.   def draw_actor_xp(actor, x, y, width = 120)
  28.     draw_actor_xp_gauge(actor, x, y, width)
  29.     self.contents.font.color = system_color
  30.     self.contents.draw_text(x, y, 30, WLH, "XP")
  31.     self.contents.font.color = normal_color
  32.     last_font_size = self.contents.font.size
  33.     if width < 120
  34.       self.contents.draw_text(x + 32, y, width - 32, WLH, actor.exp_til, 2)
  35.     else
  36.       self.contents.font.color = normal_color
  37.       text = actor.exp_til.to_s + " / " + actor.exp_max.to_s
  38.       text = actor.level == 99 ? "-------" : text
  39.       self.contents.draw_text(x + 32, y, width - 32, WLH, text, 2)
  40.     end
  41.   end
  42.   def draw_actor_xp_gauge(actor, x, y, width = 120)
  43.     gw = actor.exp_max != 0 ? width * actor.exp_til / actor.exp_max : width
  44.     gc1 = text_color(16)
  45.     gc2 = text_color(22)
  46.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  47.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  48.   end
  49.   def draw_neo_pic(x, y, filename = "BackImage")
  50.     bitmap = Cache.picture(filename)
  51.     rect = Rect.new(0, 0, 0, 0)
  52.     rect.width = bitmap.width
  53.     rect.height = bitmap.height
  54.     self.contents.blt(x, y, bitmap, rect)
  55.     bitmap.dispose
  56.   end
  57.  
  58. end
  59.  
  60. class Scene_Menu < Scene_Base
  61.   include Z_Systems::NeoMenu::SSSII
  62.  
  63.   def start
  64.     create_menu_background
  65.     @gold_window = Window_Gold.new(0, 360)
  66.     @status_window = Window_MenuStatus.new(160, 0)
  67.     create_command_window
  68.   end
  69.  
  70.   def command_window_index
  71.     return 0 if @command_window.nil?
  72.     return @command_window.index
  73.   end
  74.  
  75. end
  76.  
  77. class Window_MenuStatus < Window_Selectable
  78.   include Z_Systems::NeoMenu::SSSII
  79.   include Z_Systems::NeoMenu
  80.  
  81.   def initialize(x, y)
  82.     super(0, 0, 544, 352)
  83.     @last_index = 0
  84.     refresh
  85.     self.active = false
  86.     self.index = -1
  87.   end
  88.  
  89.   def refresh
  90.     self.contents.clear
  91.     @item_max = $game_party.members.size
  92.     @last_index = $scene.command_window_index
  93.     self.contents.draw_text(304, 0, 272, WLH, MENU_ITEMS[@last_index])
  94.     for actor in $game_party.members
  95.       x = actor.index * 128
  96.       y = 120
  97.       draw_neo_pic(x, 24, actor.id.to_s + "_A")
  98.       draw_actor_name(actor, x, y)
  99.       draw_actor_level(actor, x + 70, y + WLH)
  100.       draw_actor_state(actor, x, y - WLH)
  101.       draw_actor_hp(actor, x, y + WLH * 2)
  102.       draw_actor_mp(actor, x, y + WLH * 3)
  103.       draw_actor_xp(actor, x, y + WLH * 4)
  104.     end
  105.     array = ACTORS.to_a
  106.     for actor in $game_party.members
  107.       array -= [actor.id]
  108.     end
  109.     x = 0
  110.     for actor_id in array
  111.       draw_neo_pic(x, 240, actor_id.to_s + "_B")
  112.       x += 128
  113.     end
  114.   end
  115.  
  116.   def update_cursor
  117.     if @index < 0               # No cursor
  118.       self.cursor_rect.empty
  119.     elsif @index < @item_max    # Normal
  120.       self.cursor_rect.set(@index*128, 24, 128, 216)
  121.     elsif @index >= 100         # Self
  122.       self.cursor_rect.set((@index - 100)*128,  24, 128, 216)
  123.     else                        # All
  124.       self.cursor_rect.set(0, 0, 128, 216)
  125.     end
  126.   end
  127.  
  128.   def update
  129.     super
  130.     refresh if @last_index != $scene.command_window_index
  131.     if cursor_movable?
  132.       last_index = @index
  133.       if Input.repeat?(Input::RIGHT)
  134.         cursor_down(Input.trigger?(Input::RIGHT))
  135.       end
  136.       if Input.repeat?(Input::LEFT)
  137.         cursor_up(Input.trigger?(Input::LEFT))
  138.       end
  139.       if Input.repeat?(Input::RIGHT)
  140.         cursor_right(Input.trigger?(Input::RIGHT))
  141.       end
  142.       if Input.repeat?(Input::LEFT)
  143.         cursor_left(Input.trigger?(Input::LEFT))
  144.       end
  145.       if Input.repeat?(Input::R)
  146.         cursor_pagedown
  147.       end
  148.       if Input.repeat?(Input::L)
  149.         cursor_pageup
  150.       end
  151.       if @index != last_index
  152.         Sound.play_cursor
  153.       end
  154.     end
  155.     update_cursor
  156.     call_update_help
  157.   end
  158. end
  159.  
  160. class Window_CommandNMS < Window_Selectable
  161.  
  162.   def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
  163.     if row_max == 0
  164.       row_max = (commands.size + column_max - 1) / column_max
  165.     end
  166.     super(0, 0, 32*commands.size+32, WLH + 32, 0)
  167.     @commands = commands
  168.     @item_max = commands.size
  169.     @column_max = @item_max
  170.     refresh
  171.     self.index = 0
  172.     self.opacity = 0
  173.   end
  174.  
  175.   def draw_item(index, enabled = true)
  176.     rect = item_rect(index)
  177.     rect.x += 4
  178.     rect.width -= 8
  179.     self.contents.clear_rect(rect)
  180.     self.contents.font.color = normal_color
  181.     self.contents.font.color.alpha = enabled ? 255 : 128
  182.     if Z_Systems::NeoMenu::ICONS[@commands[index]] != nil
  183.       draw_icon(Z_Systems::NeoMenu::ICONS[@commands[index]], rect.x, rect.y)
  184.       rect.x += 24
  185.     end
  186. #~     self.contents.draw_text(rect, @commands[index])
  187.   end
  188.  
  189. end
  190.  
  191. class Game_Map
  192.   def name
  193.     data = load_data("Data/MapInfos.rvdata")
  194.     return data[@map_id].name
  195.   end
  196. end
  197.  
  198. class Window_Gold < Window_Base
  199.  
  200.   def initialize(x, y)
  201.     super(x, y, 544, WLH + 32)
  202.     refresh
  203.   end
  204.  
  205.   def refresh
  206.     draw_currency_value($game_party.gold, 4, 0, 120)
  207.     self.contents.font.color = normal_color
  208.     self.contents.draw_text(192, 0, 128, WLH, $game_map.name, 1)
  209.   end
  210.  
  211.   def update
  212.     self.contents.clear
  213.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  214.     hour = @total_sec / 360
  215.     min = (@total_sec / 60) % 60
  216.     sec = @total_sec % 60
  217.     time = sprintf("%02d:%02d:%02d", hour, min, sec)
  218.     self.contents.font.color = normal_color
  219.     self.contents.draw_text(384, 0, 128, WLH, time, 2)
  220.     refresh
  221.   end
  222. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement