Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * SEE - Item Menu ACE
- # * By Crazyninjaguy
- # * Requested by BizarreMonkey
- # * http://www.stormxstudios.co.uk
- # * 02/01/2012
- # * If you like my scripts, please show your appreciation by checking out
- # my friendly, helpful Game Development Community, StormCross Studios.
- # ---------------------------------------------------------------------------
- # * Aliased Methods
- # - start (Scene_Item)
- # - update_item_selection (Scene_Item)
- # - terminate (Scene_Item)
- # ---------------------------------------------------------------------------
- # * This script adds a new item description window with support for four text
- # text lines and a 96 x 96 picture in Graphics/Pictures.
- # * To add a picture for your item, add this into the notebox of that item in
- # the database
- # * <picture potionpicture>
- # * Replacing potionpicture for your image filename.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["SEE - Item Menu Ace"] = true
- #===============================================================================
- # * Main StormCross Engine Evolution Configuration Module
- #===============================================================================
- module SEE
- #=============================================================================
- # * Item Menu Configuration Module
- #=============================================================================
- module Item
- ITEMS = []
- #===========================================================================
- # * The number at the beginning of the ITEMS[1] is the item id in the
- # database.
- # * Each line of text in quotes is a seperate line in the window.
- # Seperate each with a comma
- #===========================================================================
- ITEMS[2] = ["A tool I use to find clues and examine small", "details with. It's also useful for lighting", "fires."]
- ITEMS[3] = ["A set of tools used for taking fingerprints. It", "is only useful when I have something to compare", "them against, however."]
- 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."]
- ITEM_COLOURS = []
- #===========================================================================
- # * As with the previous, the number at the beginning of COLOURS[1] is the
- # item id in the database.
- # * The numbers in the array correspond to the text_color() argument of
- # window base. 0 is white. You can find these by looking at the
- # Window.png graphic. Seperate each value with a comma.
- #===========================================================================
- ITEM_COLOURS[1] = [6, 0, 0, 0]
- end # Item
- end # SEE
- module ReadNote
- module DTOPM
- #Window skin to use, place in system.
- WINDOW = ('Window')
- #Status Window X
- SX = 10
- #Status Window Y
- SY = 10
- end
- def read_note(note, tag, position = 1)
- note2 = note.dup
- lines = note2.scan(/<.+>/)
- for line in lines
- words = line.split(/[ <>]/)
- words.delete("")
- for word in words
- if word == tag
- result = words[words.index(word) + position]
- return true if result == nil
- return result
- end
- end
- end
- return false
- end
- end
- class Scene_Item < Scene_ItemBase
- def start
- super
- create_description_window
- create_category_window
- create_item_window
- create_status_window
- @description_index = 0
- end
- def create_description_window
- @description = Window_ItemDescription.new
- @description.viewport = @viewport
- end
- def create_category_window
- @category_window = Window_ItemCategory.new
- @category_window.viewport = @viewport
- @category_window.y = @description.height
- @category_window.set_handler(:ok, method(:on_category_ok))
- @category_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # * Create Status Window
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_MenuInfo.new((DTOPM::SX), (DTOPM::SY))
- @status_window.windowskin = Cache.system(DTOPM::WINDOW)
- end
- def create_item_window
- wy = (@description_window.width - 200) + (@description_window.height - 120)
- wh = (Graphics.height - 264 )#wy
- @item_window = Window_ItemList.new(104 , wy, (Graphics.width - 114), wh)
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- # @category_window.item_window = @item_window
- @item_window.viewport = @viewport
- end
- def on_item_cancel
- return_scene
- end
- def update
- super
- if @description_index != @item_window.index
- @description.refresh(@item_window.item)
- @description_index = @item_window.index
- end
- end
- end
- class Window_ItemDescription < Window_Base
- include ReadNote
- include SEE::Item
- def initialize (item = nil)
- super(10, 172, (Graphics.width - 20), (Graphics.height - 184))
- refresh(item)
- def contents_width
- width - standard_padding
- end
- end # initialize
- class Window_MenuInfo < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization 172
- # x : window X coordinate
- # y : window Y coordinate
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 0, 52)
- refresh
- end
- def on_item_cancel
- @item_window.unselect
- @category_window.activate
- SceneManager.return
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @actor = $game_party.members[0]
- draw_actor_face(@actor, 0, 0, width = 92)
- draw_actor_name(@actor, 12, 104)
- end
- end
- def refresh(item)
- self.contents.clear
- if item != nil
- if item.is_a?(RPG::Item)
- picture = read_note($data_items[item.id].note, "picture")
- if picture != false
- bitmap = Cache.picture(picture)
- rect = Rect.new(0, 0, 96, 96)
- self.contents.blt(0, 0, bitmap, rect)
- end
- if item.is_a?(RPG::Item)
- if ITEMS[item.id] != nil
- if ITEM_COLOURS[item.id] != nil
- self.contents.font.color = text_color(ITEM_COLOURS[item.id][0])
- self.contents.draw_text(0, 0, width - 128, 24, ITEMS[item.id][0])
- self.contents.font.color = text_color(ITEM_COLOURS[item.id][1])
- self.contents.draw_text(0, 24, width - 128, 24, ITEMS[item.id][1])
- self.contents.font.color = text_color(ITEM_COLOURS[item.id][2])
- self.contents.draw_text(0, 48, width - 128, 24, ITEMS[item.id][2])
- self.contents.font.color = text_color(ITEM_COLOURS[item.id][3])
- self.contents.draw_text(0, 72, width - 128, 24, ITEMS[item.id][3])
- self.contents.font.color = text_color(0)
- else
- self.contents.draw_text(0, 0, width - 128, 24, ITEMS[item.id][0])
- self.contents.draw_text(0, 24, width - 128, 24, ITEMS[item.id][1])
- self.contents.draw_text(0, 48, width - 128, 24, ITEMS[item.id][2])
- self.contents.draw_text(0, 72, width - 128, 24, ITEMS[item.id][3])
- end
- end
- end
- end
- end
- end # refresh
- end # Window_ItemDescription
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement