Vlue

Simple Icon Inventory

Jul 18th, 2014
498
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Simple Icon Inventory v1.0
  2. #----------#
  3. #Features: Look, Icons! Instead of a list!
  4. #
  5. #Usage:    Plug and play.
  6. #
  7. #----------#
  8. #-- Script by: V.M of D.T
  9. #
  10. #- Questions or comments can be:
  11. #    given by email: sumptuaryspade@live.ca
  12. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  13. #   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
  14. #
  15. #--- Free to use in any project, commercial or non-commercial, with credit given
  16. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  17.  
  18. class Window_ItemList < Window_Selectable
  19.   def col_max
  20.     (self.width - standard_padding) / 42
  21.   end
  22.   def page_row_max
  23.     7
  24.   end
  25.   def item_height
  26.     36
  27.   end
  28.   def item_width
  29.     36
  30.   end
  31.   def contents_height
  32.     [super - super % item_height, row_max * (item_height + spacing)].max
  33.   end
  34.   def spacing
  35.     6
  36.   end
  37.   def top_row
  38.     oy / (item_height + spacing)
  39.   end
  40.   def top_row=(row)
  41.     row = 0 if row < 0
  42.     row = row_max - 1 if row > row_max - 1
  43.     self.oy = row * (item_height + spacing)
  44.   end
  45.   def item_rect(index)
  46.     rect = Rect.new
  47.     rect.width = item_width
  48.     rect.height = item_height
  49.     rect.x = index % col_max * (item_width + spacing) + spacing
  50.     rect.y = index / col_max * (item_height + spacing) + spacing
  51.     rect
  52.   end
  53.   def draw_item(index)
  54.     item = @data[index]
  55.     if item
  56.       rect = item_rect(index)
  57.       rect.width -= 4
  58.       rect.x += 2
  59.       big_rect = Rect.new(rect.x-1,rect.y-1,rect.width+2,rect.height+2)
  60.       contents.fill_rect(big_rect, Color.new(0,0,0,255))
  61.       contents.fill_rect(rect, Color.new(0,0,0,100))
  62.       draw_icon(item.icon_index, rect.x+6, rect.y+6)
  63.       contents.font.size = 12
  64.       number = $game_party.item_number(item)
  65.       if number > 1
  66.         draw_text(rect.x + 20, rect.y + 28, 24, contents.font.size, "x" + number.to_s)
  67.       end
  68.     end
  69.   end
  70. end
  71.  
  72. class Scene_Item
  73.   alias itemdetail_start start
  74.   def start
  75.     itemdetail_start
  76.     @detail_window = Window_ItemDetail.new(Graphics.width/3*2,@item_window.y,Graphics.width/3,Graphics.height-@item_window.y)
  77.   end
  78.   def update
  79.     super
  80.     @detail_window.set_item(@item_window.item)
  81.   end
  82.   alias icon_ciw create_item_window
  83.   def create_item_window
  84.     icon_ciw
  85.     @item_window.width = Graphics.width/3*2
  86.   end
  87. end
  88.  
  89. class Window_ItemDetail < Window_Base
  90.   def initialize(x,y,w,h)
  91.     super(x,y,w,h)
  92.     @item = nil
  93.   end
  94.   def set_item(item)
  95.     return if item == @item
  96.     @item = item
  97.     refresh
  98.   end
  99.   def refresh
  100.     contents.clear
  101.     contents.font.size = 18
  102.     draw_item_name(@item,0,0,true,contents.width-24)
  103.     contents.font.size = 24
  104.     @yy = 48
  105.     if @item.is_a?(RPG::EquipItem)
  106.       8.times do |i|
  107.         if @item.params[i] != 0
  108.           change_color(system_color)
  109.           draw_text(24,@yy,contents.width,24,Vocab::param(i) + ": ")
  110.           change_color(normal_color)
  111.           draw_text(24,@yy,contents.width/3*2,24,@item.params[i],2)
  112.           @yy += 24
  113.         end
  114.       end
  115.     end
  116.     if @item.is_a?(RPG::UsableItem)
  117.       cures = []
  118.       @item.effects.each do |effect|
  119.         if effect.code == 11
  120.           if effect.value1 > 0
  121.             draw_text_ex(24,@yy,'\c[1]HP\c[0] +' + (effect.value1 * 100).to_i.to_s + '%  ')
  122.             @yy += 24
  123.           end
  124.           if effect.value2 > 0
  125.             draw_text_ex(24,@yy,'\c[1]HP\c[0] +' + effect.value2.to_i.to_s + '  ')
  126.             @yy += 24
  127.           end
  128.         end
  129.         if effect.code == 12
  130.           if effect.value1 > 0
  131.             draw_text_ex(24,@yy,'\c[1]MP\c[0] +' + (effect.value1 * 100).to_i.to_s + '%  ')
  132.             @yy += 24
  133.           end
  134.           if effect.value2 > 0
  135.             draw_text_ex(24,@yy,'\c[1]MP\c[0] +' + effect.value2.to_i.to_s + '  ')
  136.             @yy += 24
  137.           end
  138.         end
  139.         if effect.code == 22
  140.           cures.push(effect.data_id)
  141.         end
  142.       end
  143.       if cures.size > 0
  144.         draw_text_ex(24,@yy,'\c[1]Cures:\c[0] ')
  145.         @yy += 24
  146.         cures.each do |id|
  147.           name = $data_states[id].name
  148.           draw_text(48,@yy,contents.width-48,24,name)
  149.           @yy += 24
  150.         end
  151.       end
  152.     end
  153.   end
  154. end
  155.  
  156. class Scene_Equip
  157.   alias icon_ciw create_item_window
  158.   def create_item_window
  159.     icon_ciw
  160.     @item_window.width = Graphics.width/3*2
  161.     @detail_window = Window_ItemDetail.new(Graphics.width/3*2,@item_window.y,Graphics.width/3,@item_window.height)
  162.   end
  163.   def update
  164.     super
  165.     @detail_window.set_item(@item_window.item)
  166.   end
  167. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×