################################################################################
# IXFURU'S TOOLBOX
# Written By: IXFURU
# 8/11/12
################################################################################
################################################################################
# This script allows you to add a 'callable' window through player
# input which will show a quick window with icons of items and a value next
# to it showing the amount of the item which is currently in possession.
################################################################################
################################################################################
# Credit: IXFURU
# Please give credit if you use, a link to the project would be thanks enough
################################################################################
################################################################################
# CONFIGURATION SECTION
################################################################################
module ITB
TOOLS = [3, 5, 8, 12, 21] #item ids of tools to display
TOOLSWITCH = 20 # Switch toggled to open/close window if above is true
TOOLSWITCH_INPUT = Input::R # This is the input key
# used to open and close the toolbox window.
TOOL_TEXT = "Tools" #Text displayed at top of toolbox window
TOOL_TEXT_COLOR = 29 # Text color for TOOL_TEXT. Integer 0-31
TOOLBOX_X = 440 #X location of where the toolbox opens
TOOLBOX_Y = 100 #Y location of where the toolbox opens
NO_TOOLS_COLOR = 18 #Color of tool amount when zero are in possession
SOME_TOOLS_COLOR = 0 #Color of tool amount when one or more are in possession
TOOLBOX_WIDTH = 100 #width of the window
TOOLBOX_HEIGHT_MULTIPLIER = 38 #height of the window is based on amount of tools
#multiplied by this value
end
################################################################################
# END CONFIGURATION SECTION
################################################################################
class Window_Toolbox < Window_Base
def initialize
super(ITB::TOOLBOX_X, ITB::TOOLBOX_Y, ITB::TOOLBOX_WIDTH, ITB::TOOLS.size * ITB::TOOLBOX_HEIGHT_MULTIPLIER)
@x = ITB::TOOLBOX_X #set the x position of toolbox
@y = ITB::TOOLBOX_Y #set teh y position of toolbox
draw_toolbox_text #call method to draw text
end
def draw_toolbox_text
self.contents.font.color = text_color(ITB::TOOL_TEXT_COLOR) #set color of text
self.contents.draw_text((ITB::TOOLBOX_WIDTH-self.width)/2, 4, self.width, WLH, ITB::TOOL_TEXT) # draw the text
end
def refresh
contents.clear
draw_toolbox_text
tib = 0 # create the iteration variable
tibsy = 30 #set iteration variable used for y positioning
for i in ITB::TOOLS # once for each item in the toolbox
tool = $data_items[ITB::TOOLS[tib]]
draw_icon(tool.icon_index, 4, tibsy, enabled = true)
if $game_party.item_number($data_items[ITB::TOOLS[tib]]) == 0 # if party doesn't have this item
self.contents.font.color = text_color(ITB::NO_TOOLS_COLOR)
else
self.contents.font.color = text_color(ITB::SOME_TOOLS_COLOR)
end
self.contents.draw_text(40, tibsy, self.width, WLH, $game_party.item_number($data_items[ITB::TOOLS[tib]]))
tibsy += 24
tib += 1
end
end #End of Method
end #End of Class
##############################################################################
# Scene_Map
##############################################################################
class Scene_Map < Scene_Base
def close_toolbox
Sound.play_decision
$game_switches[ITB::TOOLSWITCH] = false
@tool_window.dispose
end
def update_toolbox
@tool_window.refresh
end
def open_toolbox
Sound.play_decision
$game_switches[ITB::TOOLSWITCH] = true
@tool_window = Window_Toolbox.new
end
def check_for_toolbox_input
if Input.trigger?(ITB::TOOLSWITCH_INPUT)
if $game_switches[ITB::TOOLSWITCH] == false
open_toolbox
else
close_toolbox
end
end
end
alias itb_sm_update update
def update
itb_sm_update
if $game_switches[ITB::TOOLSWITCH] == true
update_toolbox
check_for_toolbox_input
else
check_for_toolbox_input
end
end
alias itb_sm_call_battle call_battle
def call_battle
itb_sm_call_battle
$game_switches[ITB::TOOLSWITCH] = false
end
alias itb_sm_call_shop call_shop
def call_shop
itb_sm_call_shop
$game_switches[ITB::TOOLSWITCH] = false
end
alias itb_sm_call_name call_name
def call_name
itb_sm_call_name
$game_switches[ITB::TOOLSWITCH] = false
end
alias itb_sm_call_menu call_menu
def call_menu
itb_sm_call_menu
$game_switches[ITB::TOOLSWITCH] = false
end
alias itb_sm_call_save call_save
def call_save
itb_sm_call_save
$game_switches[ITB::TOOLSWITCH] = false
end
alias itb_sm_call_debug call_debug
def call_debug
itb_sm_call_debug
$game_switches[ITB::TOOLSWITCH] = false
end
alias itb_sm_call_gameover call_gameover
def call_gameover
itb_sm_call_gameover
$game_switches[ITB::TOOLSWITCH] = false
end
alias itb_sm_call_title call_title
def call_title
itb_sm_call_title
$game_switches[ITB::TOOLSWITCH] = false
end
end