Advertisement
Zetu

FFXIII v1.05

Jul 16th, 2011
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 12.45 KB | None | 0 0
  1. #=========================================================================#
  2. # Final Fantasy XII Sytle Menu (Requested by Ziimo)  v1.05                #
  3. # * THIS ADD-ON REQUIRES the Script "Z-Systems Neo Menu System" by Zetu * #
  4. #=========================================================================#
  5. module Z_Systems
  6.   module NeoMenu
  7.     FFXIIDEFAULTFONT = "Calibri" # If you wish to use default, set to ""
  8.     DEFAULTFONTNAME  = "Verdana"
  9.     ACTOR_CLASS_COLOR = [] #If any class id does not exist, will return 0.
  10.     ACTOR_CLASS_COLOR[1] = 3
  11.     ACTOR_CLASS_COLOR[2] = 8
  12.     ACTOR_CLASS_COLOR[3] = 14
  13.     ACTOR_CLASS_COLOR[4] = 28
  14.   end
  15. end
  16.  
  17. class Scene_Menu < Scene_Base
  18.  
  19.   def create_command_window
  20.     @bar_window = Window_Bar.new(23)
  21.     @bar_window.opacity = 0
  22.     @command_window = Window_Command.new(160, Z_Systems::NeoMenu::MENU_ITEMS)
  23.     @command_window.y += 10
  24.     @command_window.opacity = 0
  25.     @time_window = Window_Stats.new(192, 375, [1])
  26.     @time_window.opacity = 0
  27.     zs_nms_disable
  28.   end
  29.  
  30.   alias ffxiii_start start unless $@
  31.   def start
  32.     ffxiii_start start
  33.     @gold_window.x = 396
  34.     @gold_window.y = 375
  35.     @gold_window.opacity = 0
  36.     @status_window.x = 152
  37.     @status_window.y = 7
  38.     @status_window.opacity = 0
  39.     @map_window = Window_Stats.new(4, 375, [2])
  40.     @map_window.opacity = 0
  41.   end
  42.  
  43.   alias nms_terminate terminate unless $@
  44.   def terminate
  45.     nms_terminate
  46.     @bar_window.dispose
  47.     @map_window.dispose
  48.   end
  49.  
  50.   alias upd update unless $@
  51.   def update
  52.     upd
  53.     @map_window.update
  54.   end
  55.  
  56. end
  57.  
  58. class Window_MenuStatus < Window_Selectable
  59.  
  60.   def refresh
  61.     self.contents.clear
  62.     get_font_type
  63.     @item_max = $game_party.members.size
  64.     nms_create_contents(0, 4*92)
  65.     for actor in $game_party.members
  66.       draw_actor_face(actor, 2, actor.index * 92 + 2, 90)
  67.       x = 104
  68.       y = actor.index * 92
  69.       draw_actor_state(actor, x + 96, y + WLH * 2)
  70.       draw_actor_name(actor, x + 8, y + 68)
  71.       draw_actor_class_ffxii(actor, x + 96, y + 68)
  72.       draw_actor_level_ffxii(actor, x - 8, y - 8, 88)
  73.       draw_actor_stats_ffxii(actor, x + 96, y + 4,  actor.hp, actor.maxhp, 4, hp_color(actor))
  74.       draw_actor_stats_ffxii(actor, x + 96, y + 32, actor.mp, actor.maxmp, 3, mp_color(actor))
  75.     end
  76.     return_font_type
  77.   end
  78.  
  79.   def update_cursor
  80.     nms_set_cursor(0, @index, 0, 91, contents.width, 92)
  81.   end
  82.  
  83. end
  84.  
  85. class Window_Base < Window
  86.  
  87.   def get_font_type
  88.     fontname = Z_Systems::NeoMenu::FFXIIDEFAULTFONT
  89.     if fontname != ""
  90.       Font.default_shadow = true
  91.       Font.default_name = fontname
  92.     end
  93.   end
  94.  
  95.   def return_font_type
  96.     Font.default_shadow = false
  97.     Font.default_name = Z_Systems::NeoMenu::DEFAULTFONTNAME
  98.   end
  99.  
  100.   def draw_actor_class_ffxii(actor, x, y)
  101.     if Z_Systems::NeoMenu::ACTOR_CLASS_COLOR[actor.id] != nil
  102.       self.contents.font.color = text_color(Z_Systems::NeoMenu::ACTOR_CLASS_COLOR[actor.id])
  103.     else
  104.       self.contents.font.color = normal_color
  105.     end
  106.     self.contents.draw_text(x, y, 108, WLH, actor.class.name)
  107.   end
  108.  
  109.   def draw_actor_level_ffxii(actor, x, y, size = 32)
  110.     self.contents.font.color = text_color(7)
  111.     self.contents.font.size = size
  112.     if actor.level < 10
  113.       text = "0" + actor.level.to_s
  114.     else
  115.       text = actor.level
  116.     end
  117.     self.contents.draw_text(x, y, size, size, text, 2)
  118.     self.contents.font.size = 24
  119.     self.contents.font.color = normal_color
  120.   end
  121.  
  122.   def draw_actor_stats_ffxii(actor, x, y, min, max, dig, color = text_color(0))
  123.     slots = []
  124.     while 1
  125.       if dig <= 0
  126.         break
  127.       else
  128.         slots.push(dig)
  129.         dig -= 1
  130.       end
  131.     end
  132.     self.contents.font.color.alpha = 128
  133.     for i in slots
  134.       value = mod_dig(min, i, slots.size)
  135.       if value != 0
  136.         self.contents.font.color = color
  137.         self.contents.font.color.alpha = 255
  138.       end
  139.       self.contents.draw_text(x, y, 16, 24, value, 2)
  140.       x += 16
  141.     end
  142.     y += 4
  143.     x -= 6
  144.     self.contents.font.color = text_color(0)
  145.     self.contents.draw_text(x, y, 16, 24, "/", 2)
  146.     y += 4
  147.     x += 12
  148.     self.contents.font.color.alpha = 128
  149.     for i in slots
  150.       value = mod_dig(max, i, slots.size)
  151.       if value != 0
  152.         self.contents.font.color = color
  153.         self.contents.font.color.alpha = 255
  154.       end
  155.       self.contents.draw_text(x, y, 16, 24, value, 2)
  156.       x += 16
  157.     end
  158.     self.contents.font.color = normal_color
  159.     self.contents.font.color.alpha = 255
  160.   end
  161.  
  162.   def mod_dig(num, dig, max = 4)
  163.     max = 3 if num < 1000
  164.     max = 2 if num < 100
  165.     max = 1 if num < 10
  166.     array = num.to_s.split(//)
  167.     id = max - dig
  168.     var = (id >= 0) ? array[id].to_i : 0
  169.     return var
  170.   end
  171.  
  172.   def draw_stat(value, new_value, x, y, max_dig = 3)
  173.     self.contents.font.color = normal_color
  174.     valuearray = new_value.to_s.split(//)
  175.     tarray = []
  176.     for i in 0...max_dig-valuearray.size do tarray.push("0") end
  177.     self.contents.font.color.alpha = 128
  178.     valuearray = tarray + valuearray
  179.     for tvalue in valuearray
  180.       if tvalue != "0"
  181.         self.contents.font.color = new_parameter_color(value, new_value)
  182.         self.contents.font.color.alpha = 255
  183.       end
  184.       self.contents.draw_text(x, y, 30, WLH, tvalue, 2)
  185.       x += 12
  186.     end
  187.   end
  188.  
  189.   def new_parameter_color(old_value, new_value)
  190.     if new_value > old_value
  191.       return power_up_color
  192.     elsif new_value == old_value
  193.       return normal_color
  194.     else
  195.       return power_down_color
  196.     end
  197.   end
  198.  
  199. end
  200.  
  201. class Scene_Item < Scene_Base
  202.  
  203.   def start
  204.     super
  205.     create_menu_background
  206.     @viewport = Viewport.new(0, 0, 544, 416)
  207.     @help_window = Window_Help.new
  208.     @help_window.y += 4
  209.     @help_window.viewport = @viewport
  210.     @help_window.opacity = 0
  211.     @item_window = Window_Item.new(0, 60, 544, 360)
  212.     @item_window.viewport = @viewport
  213.     @item_window.help_window = @help_window
  214.     @item_window.active = false
  215.     @item_window.opacity = 0
  216.     @item_window.y -= 24
  217.     @target_window = Window_MenuStatus.new(0, 0)
  218.     hide_target_window
  219.     @bar_window = Window_Bar.new(23)
  220.     @bar_window.opacity = 0
  221.   end
  222.  
  223.   alias nms_terminate terminate
  224.   def terminate
  225.     nms_terminate
  226.     @bar_window.dispose
  227.   end
  228.  
  229. end
  230.  
  231. class Scene_Equip < Scene_Base
  232.  
  233.   def start
  234.     super
  235.     @bar_window = Window_Bar.new(23)
  236.     @bar_window.opacity = 0
  237.     create_menu_background
  238.     @actor = $game_party.members[@actor_index]
  239.     @help_window = Window_Help.new
  240.     @help_window.opacity = 0
  241.     @help_window.y += 10
  242.     create_item_windows
  243.     @equip_window = Window_Equip.new(208, 56, @actor)
  244.     @equip_window.help_window = @help_window
  245.     @equip_window.index = @equip_index
  246.     @equip_window.opacity = 0
  247.     @status_window = Window_EquipStatus.new(0, 56, @actor)
  248.     @status_window.opacity = 0
  249.   end
  250.  
  251.   def terminate
  252.     super
  253.     dispose_menu_background
  254.     @help_window.dispose
  255.     @equip_window.dispose
  256.     @status_window.dispose
  257.     @bar_window.dispose
  258.     dispose_item_windows
  259.   end
  260.  
  261.   def create_item_windows
  262.     @item_windows = []
  263.     for i in 0...EQUIP_TYPE_MAX
  264.       @item_windows[i] = Window_EquipItem.new(0, 208, 544, 208, @actor, i)
  265.       @item_windows[i].help_window = @help_window
  266.       @item_windows[i].visible = (@equip_index == i)
  267.       @item_windows[i].y = 208
  268.       @item_windows[i].height = 208
  269.       @item_windows[i].active = false
  270.       @item_windows[i].index = -1
  271.       @item_windows[i].opacity = 0
  272.     end
  273.   end
  274.  
  275. end
  276.  
  277. class Scene_Skill < Scene_Base
  278.  
  279.   def start
  280.     super
  281.     create_menu_background
  282.     @bar_window = Window_Bar.new(23)
  283.     @bar_window.opacity = 0
  284.     @actor = $game_party.members[@actor_index]
  285.     @viewport = Viewport.new(0, 0, 544, 416)
  286.     @help_window = Window_Help.new
  287.     @help_window.viewport = @viewport
  288.     @help_window.opacity = 0
  289.     @help_window.y += 10
  290.     @status_window = Window_SkillStatus.new(0, 32, @actor)
  291.     @status_window.viewport = @viewport
  292.     @status_window.opacity = 0
  293.     @skill_window = Window_Skill.new(0, 79, 544, 304, @actor)
  294.     @skill_window.viewport = @viewport
  295.     @skill_window.help_window = @help_window
  296.     @skill_window.opacity = 0
  297.     @skill_window.y += 23
  298.     @target_window = Window_MenuStatus.new(0, 0)
  299.     hide_target_window
  300.   end
  301.  
  302.   def terminate
  303.     super
  304.     dispose_menu_background
  305.     @help_window.dispose
  306.     @status_window.dispose
  307.     @skill_window.dispose
  308.     @target_window.dispose
  309.     @bar_window.dispose
  310.   end
  311.  
  312. end
  313.  
  314. class Window_SkillStatus < Window_Base
  315.  
  316.   def initialize(x, y, actor)
  317.     super(x, y, 544, 128)
  318.     @actor = actor
  319.     refresh
  320.   end
  321.  
  322.   def refresh
  323.     self.contents.clear
  324.     draw_actor_level_ffxii(@actor, 96, 0, 68)
  325.     draw_actor_stats_ffxii(@actor, 192, 4,  @actor.hp, @actor.maxhp, 4)
  326.     draw_actor_stats_ffxii(@actor, 192, 32, @actor.mp, @actor.maxmp, 3)
  327.     draw_actor_name(@actor, 0, 24)
  328.   end
  329.  
  330. end
  331.  
  332. class Window_EquipStatus < Window_Base
  333.  
  334.   def draw_parameter(x, y, type)
  335.    
  336.     case type
  337.     when 0
  338.       name = Vocab::atk
  339.       value = @actor.atk
  340.       new_value = @new_atk
  341.     when 1
  342.       name = Vocab::def
  343.       value = @actor.def
  344.       new_value = @new_def
  345.     when 2
  346.       name = Vocab::spi
  347.       value = @actor.spi
  348.       new_value = @new_spi
  349.     when 3
  350.       name = Vocab::agi
  351.       value = @actor.agi
  352.       new_value = @new_agi
  353.     end
  354.     self.contents.font.color = system_color
  355.     self.contents.draw_text(x + 4, y, 80, WLH, name)
  356.     self.contents.font.color = normal_color
  357.     draw_stat(value, value, 36, y)
  358.     self.contents.font.color = system_color
  359.     self.contents.draw_text(x + 102, y, 20, WLH, ">", 1)
  360.     x -= 16
  361.     draw_stat(value, new_value, 108, y) if new_value != nil
  362.   end
  363.  
  364. end
  365.  
  366. class Scene_Status < Scene_Base
  367.  
  368.   def start
  369.     create_menu_background
  370.     @actor = $game_party.members[@actor_index]
  371.     @bar_window = Window_Bar.new(23)
  372.     @status_window = Window_Status.new(@actor)
  373.     @status_window.opacity = 0
  374.   end
  375.  
  376.   def terminate
  377.     super
  378.     dispose_menu_background
  379.     @status_window.dispose
  380.     @bar_window.dispose
  381.   end
  382.  
  383.   def update
  384.     update_menu_background
  385.     @status_window.update
  386.     @status_window.opacity = 0
  387.     if Input.trigger?(Input::B)
  388.       Sound.play_cancel
  389.       return_scene
  390.     elsif Input.trigger?(Input::R)
  391.       Sound.play_cursor
  392.       next_actor
  393.     elsif Input.trigger?(Input::L)
  394.       Sound.play_cursor
  395.       prev_actor
  396.     end
  397.   end
  398.  
  399. end
  400.  
  401. class Window_Status < Window_Base
  402.  
  403.   def refresh
  404.     self.contents.clear
  405.     draw_actor_face(@actor, 2, 36, 90)
  406.     draw_actor_state(@actor, 102, 80)
  407.     draw_actor_name(@actor, 96, 100)
  408.     draw_actor_class(@actor, 192, 100)
  409.     draw_actor_level_ffxii(@actor, 96, 32, 68)
  410.     thpcolor = hp_color(@actor)
  411.     tmpcolor = mp_color(@actor)
  412.     draw_actor_stats_ffxii(@actor, 192, 36, @actor.hp, @actor.maxhp, 4, thpcolor)
  413.     draw_actor_stats_ffxii(@actor, 192, 64, @actor.mp, @actor.maxmp, 3, tmpcolor)
  414.     draw_parameters(32, 160)
  415.     draw_exp_info_ffxii(288, 32)
  416.     draw_equipments(288, 160)
  417.   end
  418.  
  419.   alias nms_draw_parameters draw_parameters
  420.   def draw_parameters(x, y)
  421.     self.contents.font.color = system_color
  422.     self.contents.draw_text(x - 32, y + WLH*0, 48, WLH, "ATK")
  423.     self.contents.draw_text(x - 32, y + WLH*1, 48, WLH, "DEF")
  424.     self.contents.draw_text(x - 32, y + WLH*2, 48, WLH, "SPI")
  425.     self.contents.draw_text(x - 32, y + WLH*3, 48, WLH, "AGI")
  426.     draw_stat(@actor.atk, @actor.atk, x, y + WLH*0)
  427.     draw_stat(@actor.def, @actor.def, x, y + WLH*1)
  428.     draw_stat(@actor.spi, @actor.spi, x, y + WLH*2)
  429.     draw_stat(@actor.agi, @actor.agi, x, y + WLH*3)
  430.   end
  431.  
  432.   def draw_exp_info_ffxii(x, y)
  433.     s1 = @actor.exp_s
  434.     s2 = @actor.next_rest_exp_s
  435.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  436.     self.contents.font.color = system_color
  437.     self.contents.draw_text(x+56, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
  438.     self.contents.draw_text(x+56, y + WLH * 2, 180, WLH, s_next)
  439.     self.contents.font.color = normal_color
  440.     self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2)
  441.     self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2)
  442.   end
  443.  
  444. end
  445.  
  446. class Scene_Base
  447.  
  448.   def create_menu_background
  449.     @menuback_sprite = Sprite.new
  450.     @menuback_sprite.bitmap = $game_temp.background_bitmap
  451.     @menuback_sprite.color.set(0, 0, 8, 192)
  452.     @menuback_sprite.tone = Tone.new(0, 0, 0, 234)
  453.     update_menu_background
  454.   end
  455.  
  456. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement