Advertisement
Guest User

Untitled

a guest
Oct 10th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.41 KB | None | 0 0
  1. #===============================================================================
  2. # * SEE - Item Menu ACE
  3. # * By Crazyninjaguy
  4. # * Requested by BizarreMonkey
  5. # * http://www.stormxstudios.co.uk
  6. # * 02/01/2012
  7. # * If you like my scripts, please show your appreciation by checking out
  8. # my friendly, helpful Game Development Community, StormCross Studios.
  9. # ---------------------------------------------------------------------------
  10. # * Aliased Methods
  11. # - start (Scene_Item)
  12. # - update_item_selection (Scene_Item)
  13. # - terminate (Scene_Item)
  14. # ---------------------------------------------------------------------------
  15. # * This script adds a new item description window with support for four text
  16. # text lines and a 96 x 96 picture in Graphics/Pictures.
  17. # * To add a picture for your item, add this into the notebox of that item in
  18. # the database
  19. # * <picture potionpicture>
  20. # * Replacing potionpicture for your image filename.
  21. #===============================================================================
  22.  
  23. $imported = {} if $imported == nil
  24. $imported["SEE - Item Menu Ace"] = true
  25.  
  26.  
  27.  
  28.  
  29. #===============================================================================
  30. # * Main StormCross Engine Evolution Configuration Module
  31. #===============================================================================
  32. module SEE
  33. #=============================================================================
  34. # * Item Menu Configuration Module
  35. #=============================================================================
  36. module Item
  37. ITEMS = []
  38. #===========================================================================
  39. # * The number at the beginning of the ITEMS[1] is the item id in the
  40. # database.
  41. # * Each line of text in quotes is a seperate line in the window.
  42. # Seperate each with a comma
  43. #===========================================================================
  44. ITEMS[2] = ["A tool I use to find clues and examine small", "details with. It's also useful for lighting", "fires."]
  45. ITEMS[3] = ["A set of tools used for taking fingerprints. It", "is only useful when I have something to compare", "them against, however."]
  46. ITEMS[8] = ["A letter from Mary-Anne Coletta.", "A personal letter that started this whole mess. In it Mary-Anne asks", "me for help and alludes to a terrible danger that she and the rest of", "the town are in."]
  47. ITEM_COLOURS = []
  48. #===========================================================================
  49. # * As with the previous, the number at the beginning of COLOURS[1] is the
  50. # item id in the database.
  51. # * The numbers in the array correspond to the text_color() argument of
  52. # window base. 0 is white. You can find these by looking at the
  53. # Window.png graphic. Seperate each value with a comma.
  54. #===========================================================================
  55. ITEM_COLOURS[1] = [6, 0, 0, 0]
  56.  
  57. end # Item
  58. end # SEE
  59.  
  60.  
  61. module ReadNote
  62. module DTOPM
  63.  
  64. #Window skin to use, place in system.
  65. WINDOW = ('Window')
  66.  
  67. #Status Window X
  68. SX = 10
  69.  
  70. #Status Window Y
  71. SY = 10
  72.  
  73. end
  74.  
  75. def read_note(note, tag, position = 1)
  76. note2 = note.dup
  77. lines = note2.scan(/<.+>/)
  78. for line in lines
  79. words = line.split(/[ <>]/)
  80. words.delete("")
  81. for word in words
  82. if word == tag
  83. result = words[words.index(word) + position]
  84. return true if result == nil
  85. return result
  86. end
  87. end
  88. end
  89. return false
  90. end
  91. end
  92.  
  93. class Scene_Item < Scene_ItemBase
  94. def start
  95. super
  96. create_description_window
  97. create_category_window
  98. create_item_window
  99. create_status_window
  100. @description_index = 0
  101. end
  102. def create_description_window
  103. @description = Window_ItemDescription.new
  104. @description.viewport = @viewport
  105. end
  106. def create_category_window
  107. @category_window = Window_ItemCategory.new
  108. @category_window.viewport = @viewport
  109. @category_window.y = @description.height
  110. @category_window.set_handler(:ok, method(:on_category_ok))
  111. @category_window.set_handler(:cancel, method(:return_scene))
  112. end
  113. #--------------------------------------------------------------------------
  114. # * Create Status Window
  115. #--------------------------------------------------------------------------
  116. def create_status_window
  117. @status_window = Window_MenuInfo.new((DTOPM::SX), (DTOPM::SY))
  118. @status_window.windowskin = Cache.system(DTOPM::WINDOW)
  119. end
  120.  
  121. def create_item_window
  122. wy = (@description_window.width - 200) + (@description_window.height - 120)
  123. wh = (Graphics.height - 264 )#wy
  124. @item_window = Window_ItemList.new(104 , wy, (Graphics.width - 114), wh)
  125. @item_window.set_handler(:ok, method(:on_item_ok))
  126. @item_window.set_handler(:cancel, method(:on_item_cancel))
  127. # @category_window.item_window = @item_window
  128. @item_window.viewport = @viewport
  129. end
  130.  
  131. def on_item_cancel
  132. return_scene
  133. end
  134.  
  135. def update
  136. super
  137. if @description_index != @item_window.index
  138. @description.refresh(@item_window.item)
  139. @description_index = @item_window.index
  140. end
  141.  
  142. end
  143. end
  144.  
  145. class Window_ItemDescription < Window_Base
  146. include ReadNote
  147. include SEE::Item
  148. def initialize (item = nil)
  149. super(10, 172, (Graphics.width - 20), (Graphics.height - 184))
  150. refresh(item)
  151. def contents_width
  152. width - standard_padding
  153. end
  154. end # initialize
  155.  
  156. class Window_MenuInfo < Window_Base
  157. #--------------------------------------------------------------------------
  158. # * Object Initialization 172
  159. # x : window X coordinate
  160. # y : window Y coordinate
  161. #--------------------------------------------------------------------------
  162. def initialize(x, y)
  163. super(x, y, 0, 52)
  164. refresh
  165. end
  166. def on_item_cancel
  167. @item_window.unselect
  168. @category_window.activate
  169. SceneManager.return
  170. end
  171. #--------------------------------------------------------------------------
  172. # * Refresh
  173. #--------------------------------------------------------------------------
  174. def refresh
  175. self.contents.clear
  176. @actor = $game_party.members[0]
  177. draw_actor_face(@actor, 0, 0, width = 92)
  178. draw_actor_name(@actor, 12, 104)
  179. end
  180. end
  181.  
  182. def refresh(item)
  183. self.contents.clear
  184. if item != nil
  185. if item.is_a?(RPG::Item)
  186. picture = read_note($data_items[item.id].note, "picture")
  187.  
  188. if picture != false
  189. bitmap = Cache.picture(picture)
  190. rect = Rect.new(0, 0, 96, 96)
  191. self.contents.blt(0, 0, bitmap, rect)
  192. end
  193.  
  194. if item.is_a?(RPG::Item)
  195. if ITEMS[item.id] != nil
  196. if ITEM_COLOURS[item.id] != nil
  197. self.contents.font.color = text_color(ITEM_COLOURS[item.id][0])
  198. self.contents.draw_text(0, 0, width - 128, 24, ITEMS[item.id][0])
  199. self.contents.font.color = text_color(ITEM_COLOURS[item.id][1])
  200. self.contents.draw_text(0, 24, width - 128, 24, ITEMS[item.id][1])
  201. self.contents.font.color = text_color(ITEM_COLOURS[item.id][2])
  202. self.contents.draw_text(0, 48, width - 128, 24, ITEMS[item.id][2])
  203. self.contents.font.color = text_color(ITEM_COLOURS[item.id][3])
  204. self.contents.draw_text(0, 72, width - 128, 24, ITEMS[item.id][3])
  205. self.contents.font.color = text_color(0)
  206. else
  207. self.contents.draw_text(0, 0, width - 128, 24, ITEMS[item.id][0])
  208. self.contents.draw_text(0, 24, width - 128, 24, ITEMS[item.id][1])
  209. self.contents.draw_text(0, 48, width - 128, 24, ITEMS[item.id][2])
  210. self.contents.draw_text(0, 72, width - 128, 24, ITEMS[item.id][3])
  211. end
  212. end
  213. end
  214. end
  215. end
  216. end # refresh
  217.  
  218. end # Window_ItemDescription
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement