Advertisement
TheSixth

Status Display Change by Sixth

Feb 1st, 2016
1,217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.99 KB | None | 0 0
  1. # Status Display Change
  2. # Requires: Crystal Engine - Extra Stats
  3. # Made by: Sixth
  4.  
  5. module XStatDisplayM
  6.  
  7.   # Default parameter display settings.
  8.   Params = {
  9.     :displayed => [2,3,4,5,6,7], # Displayed parameters (0 = HP, 1 = MP, 2 = ATK, etc)
  10.     :pos => [0, 168], # The X and Y position of the first displayed parameter.
  11.     :width => 100, # The width reserved for one column.
  12.     :rows => 6, # The maximum number of rows allowed for parameters.
  13.     :spacing => 8, # The horizontal spacing between columns.
  14.   }
  15.    
  16.   # Xstat display settings. Same settings as above.
  17.   XStats = {
  18.     :displayed => [:str,:sta,:spi,:cha,:wit,:vit,:blc,:res,:pow,:dex,:pro,:skl],
  19.     :pos => [108, 168],
  20.     :width => 100,
  21.     :rows => 6,
  22.     :spacing => 8,
  23.   }
  24.  
  25.   # Equip display settings. Almost the same settings as above...
  26.   Equips = {
  27.     :empty => ["Empty", 185], # The word and icon displayed for empty equip slots.
  28.     :pos => [334, 168],
  29.     :width => 100,
  30.     :rows => 6,
  31.     :spacing => 8,
  32.   }
  33.  
  34. end
  35. # End of settings! No touchy-touchy below! o.o
  36.  
  37. class Window_Base < Window
  38.  
  39.   def draw_actor_xstat(actor, x, y, w, stat)
  40.     change_color(system_color)
  41.     draw_text(x, y, w, line_height, CRYSTAL::XSTAT::TERMS[stat])
  42.     change_color(normal_color)
  43.     draw_text(x, y, w, line_height, eval("actor.xstat.#{stat}"), 2)
  44.   end
  45.  
  46. end
  47.  
  48. class Window_Status < Window_Selectable
  49.  
  50.   def draw_block3(y)
  51.     prs = XStatDisplayM::Params; xst = XStatDisplayM::XStats; eqs = XStatDisplayM::Equips
  52.     draw_parameters(prs[:pos][0],prs[:pos][1],prs[:width],prs[:rows],prs[:spacing])
  53.     draw_equipments(eqs[:pos][0],eqs[:pos][1],eqs[:width],eqs[:rows],eqs[:spacing])
  54.     draw_xstat_parameters(xst[:pos][0],xst[:pos][1],xst[:width],xst[:rows],xst[:spacing])
  55.   end
  56.    
  57.   def draw_equipments(x, y, w, rows, spacing)
  58.     @actor.equips.each_with_index do |item, i|
  59.       yy = i % rows * line_height + y
  60.       xx = (i / rows * (w + spacing)) + x
  61.       if item.nil?
  62.         draw_icon(XStatDisplayM::Equips[:empty][1], xx, yy)
  63.         change_color(normal_color,false)
  64.         draw_text(xx + 24, yy, w, line_height, XStatDisplayM::Equips[:empty][0])
  65.       else
  66.         draw_item_name(item, xx, yy, true, w)
  67.       end
  68.     end
  69.   end
  70.  
  71.   def draw_parameters(x, y, w, rows, spacing)
  72.     XStatDisplayM::Params[:displayed].each_with_index do |prm,i|
  73.       yy = i % rows * line_height + y
  74.       xx = (i / rows * (w + spacing)) + x
  75.       draw_actor_param(@actor, xx, yy, w, prm)
  76.     end
  77.   end
  78.  
  79.   def draw_actor_param(actor, x, y, w, param_id)
  80.     change_color(system_color)
  81.     draw_text(x, y, w, line_height, Vocab::param(param_id))
  82.     change_color(normal_color)
  83.     draw_text(x, y, w, line_height, actor.param(param_id), 2)
  84.   end
  85.  
  86.   def draw_xstat_parameters(x, y, w, rows, spacing)
  87.     XStatDisplayM::XStats[:displayed].each_with_index do |st,i|
  88.       yy = i % rows * line_height + y
  89.       xx = (i / rows * (w + spacing)) + x
  90.       draw_actor_xstat(@actor, xx, yy, w, st)
  91.     end
  92.   end
  93.  
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement