Advertisement
Spoofus

Spoof Window_Item non RO

Jul 15th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. #==============================================================================
  2. # ** Window_Item
  3. #------------------------------------------------------------------------------
  4. # This window displays items in possession on the item and battle screens.
  5. #==============================================================================
  6.  
  7. class Window_Item < Window_Selectable
  8. #--------------------------------------------------------------------------
  9. # * Object Initialization
  10. #--------------------------------------------------------------------------
  11. def initialize
  12. super(120, 128, 190, 90)
  13. if $game_temp.in_battle
  14. @column_max = 1
  15. end
  16. refresh
  17. self.index = 0
  18. # If in battle, move window to center of screen
  19. # and make it semi-transparent
  20. if $game_temp.in_battle
  21. self.y = 320
  22. self.height = 160
  23. self.back_opacity = $game_system.window_opacity #**
  24. end
  25. end
  26. #--------------------------------------------------------------------------
  27. # * Get Item
  28. #--------------------------------------------------------------------------
  29. def item
  30. return @data[self.index]
  31. end
  32. #--------------------------------------------------------------------------
  33. # * Refresh
  34. #--------------------------------------------------------------------------
  35. def refresh
  36. if self.contents != nil
  37. self.contents.dispose
  38. self.contents = nil
  39. end
  40. @data = []
  41. # Add item
  42. for i in 1...$data_items.size
  43. if $game_party.item_number(i) > 0
  44. @data.push($data_items[i])
  45. end
  46. end
  47. # Also add weapons and items if outside of battle
  48. unless $game_temp.in_battle
  49. for i in 1...$data_weapons.size
  50. if $game_party.weapon_number(i) > 0
  51. @data.push($data_weapons[i])
  52. end
  53. end
  54. for i in 1...$data_armors.size
  55. if $game_party.armor_number(i) > 0
  56. @data.push($data_armors[i])
  57. end
  58. end
  59. end
  60. # If item count is not 0, make a bit map and draw all items
  61. @item_max = @data.size
  62. if @item_max > 0
  63. self.contents = Bitmap.new(width - 32, row_max * 32)
  64. for i in 0...@item_max
  65. draw_item(i)
  66. end
  67. end
  68. end
  69. #--------------------------------------------------------------------------
  70. # * Draw Item
  71. # index : item number
  72. #--------------------------------------------------------------------------
  73. def draw_item(index)
  74. item = @data[index]
  75. case item
  76. when RPG::Item
  77. number = $game_party.item_number(item.id)
  78. when RPG::Weapon
  79. number = $game_party.weapon_number(item.id)
  80. when RPG::Armor
  81. number = $game_party.armor_number(item.id)
  82. end
  83. if item.is_a?(RPG::Item) and
  84. $game_party.item_can_use?(item.id)
  85. self.contents.font.color = normal_color
  86. else
  87. self.contents.font.color = disabled_color
  88. end
  89. x = 4 + index % 2 * (288 + 32)
  90. y = index / 2 * 32
  91. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  92. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  93. bitmap = RPG::Cache.icon(item.icon_name)
  94. opacity = self.contents.font.color == normal_color ? 255 : 128
  95. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  96. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  97. self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  98. self.contents.draw_text(x + 100, y, 48, 32, number.to_s, 2)
  99. end
  100. #--------------------------------------------------------------------------
  101. # * Help Text Update
  102. #--------------------------------------------------------------------------
  103. def update_help
  104. @help_window.set_text(self.item == nil ? "" : self.item.description)
  105. end
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement