PHP-Code:
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# *Item-Menu
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# created by strich
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
module CONFIG_ITEM # Configurations
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#-> Durchsichtigkeit der Fenster
OPACITY = 160
#-> Das Windowskin für die Fenster
#-> Bitte ein neues Skin erstellen was die 4 Pfeile (die oben rechts in der mitte,
#-> einen nach oben, einen nach unten, einen nach rechts und einen nach links)
#-> nicht hat, weil diese sonst im menu erscheinen.
WINDOWSKIN = "Menu"
#-> Beim Beenden des fensters kommt man auf die map/ins menü (true/false)
MAP_TRANSFER = true
#-> Beschreibungen der beiden Fenster und die schriftfarbe
ITEM_TEXT = "Items"
EQUIP_TEXT = "Ausrüstung"
INFO_COLOR = [ 255 , 255 , 255 ] #[RED, GREEN, BLUE]<- Farbmischung
#Hinweis: Die farbmischungen sind die gleichen wie bei dem Event-Befehl: Change Screen Color Tone
#-> Equipment fenster anzeigen/nicht anzeigen (true/false)
EQUIPMENT = true
#Hinweis: Es wird immer die Aurüstung von dem in der Party obersten angezeigt.
#--->UPDATE<---
###############
#-> Setze hinter die items die gestapelt werden sollen eine 1 und hinter die die
#-> nebeneinander gesetzt werden sollen ein "nil" (ohne "")
#-> !Nicht vergessen hinter jede zeile nen komma
ITEM_STAPEL = {
1 => 1 , # Item-ID=>nil/1
2 => 1 ,
3 => 1 ,
#usw...
#du kannst die die nicht gestapelt werden sollen auch einfach garnicht eintragen
}
SHOW_NUMBERS = false #<- true: alle items die NICHT gestapelt werden sind mit
#<- 1 versehen, false: nur GESTAPELTE items über 1 haben zahlen
#-> Die farben der nummern
NUM_COLOR = [ 255 , 255 , 255 ] #[RED, GREEN, BLUE]<- Farbmischung
################################################################################
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
end # Configurations end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Here we go!
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Help_Item < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
if CONFIG_ITEM :: EQUIPMENT == true
super ( 32 * 8 / 4 , 480 - 64 - 64 , 640 - 32 * 8 / 2 - 96 , 64 )
else
super ( 32 * 8 / 4 , 480 - 64 - 64 , 640 - 32 * 8 / 2 , 64 )
end
self . contents = Bitmap .new( width - 32 , height - 32 )
self . windowskin = RPG :: Cache . windowskin ( CONFIG_ITEM :: WINDOWSKIN )
self . back_opacity = CONFIG_ITEM :: OPACITY
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text ( text , align = 0 )
# If at least one part of text and alignment differ from last time
if text != @ text or align != @ align
# Redraw text
self . contents . clear
self . contents . font . color = normal_color
self . contents . draw_text ( 4 , 0 , self . width - 40 , 32 , text , align )
@ text = text
@ align = align
@ actor = nil
end
self . visible = true
end
#--------------------------------------------------------------------------
# * Set Actor
# actor : status displaying actor
#--------------------------------------------------------------------------
def set_actor ( actor )
if actor != @ actor
self . contents . clear
draw_actor_name ( actor , 4 , 0 )
draw_actor_state ( actor , 140 , 0 )
draw_actor_hp ( actor , 284 , 0 )
draw_actor_sp ( actor , 460 , 0 )
@ actor = actor
@ text = nil
self . visible = true
end
end
#--------------------------------------------------------------------------
# * Set Enemy
# enemy : name and status displaying enemy
#--------------------------------------------------------------------------
def set_enemy ( enemy )
text = enemy . name
state_text = make_battler_state_text ( enemy , 112 , false )
if state_text != ""
text += " " + state_text
end
set_text ( text , 1 )
end
end
#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_EquipRight_Item < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize ( actor )
super ( 488 , 352 , 88 , 120 )
self . contents = Bitmap .new( width - 32 , height - 32 )
self . back_opacity = CONFIG_ITEM :: OPACITY
self . windowskin = RPG :: Cache . windowskin ( CONFIG_ITEM :: WINDOWSKIN )
@ actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self . contents . clear
@ data = []
@ data . push ( $data_weapons [@ actor . weapon_id ])
@ data . push ( $data_armors [@ actor . armor1_id ])
@ data . push ( $data_armors [@ actor . armor2_id ])
@ data . push ( $data_armors [@ actor . armor3_id ])
@ data . push ( $data_armors [@ actor . armor4_id ])
draw_equip (@ data [ 0 ], 0 , 0 ) #<-- Weapon
draw_equip (@ data [ 1 ], 32 , 0 ) #<-- Shield
draw_equip (@ data [ 2 ], 0 , 32 ) #<-- Helmet
draw_equip (@ data [ 3 ], 32 , 32 ) #<-- Armor
draw_equip (@ data [ 4 ], 16 , 64 ) #<-- Accesoir
end
def draw_equip ( item , x , y )
if item == nil
return
end
bitmap = RPG :: Cache . icon ( item . icon_name )
self . contents . blt ( x , y , bitmap , Rect .new( 0 , 0 , 24 , 24 ))
end
end
#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
# This window class contains cursor movement and scroll functions.
# Ich weis, verbraucht viel platz aber muss leider sein.
#==============================================================================
class Window_Selectable_Item < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader : index # cursor position
attr_reader : help_window # help window
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize ( x , y , width , height )
super ( x , y , width , height )
@ item_max = 1
@ column_max = 1
@ index = - 1
end
#--------------------------------------------------------------------------
# * Set Cursor Position
# index : new cursor position
#--------------------------------------------------------------------------
def index =( index )
@ index = index
# Update Help Text (update_help is defined by the subclasses)
if self . active and @ help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Get Row Count
#--------------------------------------------------------------------------
def row_max
# Compute rows from number of items and columns
return (@ item_max * 2 + @ column_max - 1 ) / @ column_max
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of 32
return self . oy / 32
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row =( row )
# If row is less than 0, change it to 0
if row < 0
row = 0
end
# If row exceeds row_max - 1, change it to row_max - 1
if row > row_max - 1
row = row_max - 1
end
# Multiply 1 row height by 32 for y-coordinate of window contents
# transfer origin
self . oy = row * 32
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Subtract a frame height of 32 from the window height, and divide it by
# 1 row height of 32
return ( self . height - 32 ) / 32
end
#--------------------------------------------------------------------------
# * Get Number of Items Displayable on 1 Page
#--------------------------------------------------------------------------
def page_item_max
# Multiply row count (page_row_max) times column count (@column_max)
return page_row_max * @ column_max
end
#--------------------------------------------------------------------------
# * Set Help Window
# help_window : new help window
#--------------------------------------------------------------------------
def help_window =( help_window )
@ help_window = help_window
# Update help text (update_help is defined by the subclasses)
if self . active and @ help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @ index < 0
self . cursor_rect .empty
return
end
# Get current row
row = @ index / @ column_max
# If current row is before top row
if row < self . top_row
# Scroll so that current row becomes top row
#self.top_row = row
end
# If current row is more to back than back row
if row > self . top_row + ( self . page_row_max - 1 )
# Scroll so that current row becomes back row
#self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self . width / @ column_max - 32
# Calculate cursor coordinates
x = @ index % @ column_max * ( cursor_width + 32 )
y = @ index / @ column_max * ( 192 / 3 ) - self . oy
# Update cursor rectangle
self . cursor_rect . set ( x , y , cursor_width , 32 )
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If cursor is movable
if self . active and @ item_max > 0 and @ index >= 0
# If pressing down on the directional buttons
if Input . repeat ?( Input :: DOWN )
# If column count is 1 and directional button was pressed down with no
# repeat, or if cursor position is more to the front than
# (item count - column count)
if (@ column_max == 1 and Input . trigger ?( Input :: DOWN )) or
@ index <= ( $currentpage * 32 - @ column_max ) - 1
# Move cursor down
$game_system . se_play ( $data_system . cursor_se )
@ index = (@ index + @ column_max ) # % @item_max
end
end
# If the up directional button was pressed
if Input . repeat ?( Input :: UP )
# If column count is 1 and directional button was pressed up with no
# repeat, or if cursor position is more to the back than column count
if (@ column_max == 1 and Input . trigger ?( Input :: UP )) or
@ index >= ( $currentpage * 32 + @ column_max ) - 32 #@column_max
# Move cursor up
$game_system . se_play ( $data_system . cursor_se )
@ index = (@ index - @ column_max )
end
end
# If the right directional button was pressed
if Input . repeat ?( Input :: RIGHT )
# If column count is 2 or more, and cursor position is closer to front
# than (item count -1)
if @ column_max >= 2 and @ index <= ( $currentpage * 32 )- 2
# Move cursor right
$game_system . se_play ( $data_system . cursor_se )
@ index += 1
end
end
# If the left directional button was pressed
if Input . repeat ?( Input :: LEFT )
# If column count is 2 or more, and cursor position is more back than 0
if @ column_max >= 2 and @ index >= ( $currentpage * 32 ) - 32 + 1
# Move cursor left
$game_system . se_play ( $data_system . cursor_se )
@ index -= 1
end
end
# If R button was pressed
if Input . repeat ?( Input :: R )
# If bottom row being displayed is more to front than bottom data row
#if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# Move cursor 1 page back#
$currentpage += 1
$game_system . se_play ( $data_system . cursor_se )
@ index += 32 #[@index + self.page_item_max, @item_max - 1].min
self . top_row += 8
#end
end
# If L button was pressed
if Input . repeat ?( Input :: L )
# If top row being displayed is more to back than 0
#if self.top_row > 0
# Move cursor 1 page forward
$currentpage -= 1
$game_system . se_play ( $data_system . cursor_se )
@ index -= 32 #[@index - self.page_item_max, 0].max
self . top_row -= 8
#end
end
if $currentpage > $maxpage
$currentpage = 1
self . top_row = 0
@ index -= $maxpage * 32
end
if $currentpage < 1
$currentpage = $maxpage
self . top_row += ( $maxpage - 1 ) * 8
@ index += $maxpage * 32
end
end
# Update help text (update_help is defined by the subclasses)
if self . active and @ help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Item < Window_Selectable_Item
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super ( 32 * 8 / 4 , 64 , 640 - 32 * 8 / 2 , 32 * 8 ) #640, 416)
@ column_max = 8
refresh
self . index = 0
self . windowskin = RPG :: Cache . windowskin ( CONFIG_ITEM :: WINDOWSKIN )
self . back_opacity = CONFIG_ITEM :: OPACITY
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp . in_battle
self . y = 64
self . height = 256
self . back_opacity = 160
end
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @ data [ self . index ]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self . contents != nil
self . contents . dispose
self . contents = nil
end
@ data = []
# Add item
for i in 1. .. $data_items . size
if $game_party . item_number ( i ) > 0
item = $data_items [ i ]
#--->UPDATE
abc = CONFIG_ITEM :: ITEM_STAPEL [ item . id ]
if abc == nil
number = $game_party . item_number ( item . id )
else
number = 1
end
#########################
number . times do
@ data . push ( $data_items [ i ])
end
end
end
# If item count is not 0, make a bit map and draw all items
@ item_max = @ data . size
$maxpage = (@ item_max - 1 ) / 32 + 1
if @ item_max > 0
self . contents = Bitmap .new( width - 32 , row_max * ( 192 / 3 ))
for i in 0. ..@ item_max
draw_item ( i )
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item ( index )
item = @ data [ index ]
number = $game_party . item_number ( item . id )
x = 4 + index % 8 * 64
y = index / 8 * ( 192 / 3 )
rect = Rect .new( x , y , self . width / @ column_max - 32 , 32 )
self . contents . fill_rect ( rect , Color .new( 0 , 0 , 0 , 0 ))
bitmap = RPG :: Cache . icon ( item . icon_name )
self . contents . blt ( x , y + 4 , bitmap , Rect .new( 0 , 0 , 24 , 24 ), 255 )
#--->UPDATE
abc = CONFIG_ITEM :: ITEM_STAPEL [ item . id ]
cba = CONFIG_ITEM :: NUM_COLOR
self . contents . font . color . set ( cba [ 0 ], cba [ 1 ], cba [ 2 ])
if abc != nil
if CONFIG_ITEM :: SHOW_NUMBERS == false and number > 1
self . contents . draw_text ( x , y , 24 , 32 , number . to_s , 2 )
elsif CONFIG_ITEM :: SHOW_NUMBERS == true
self . contents . draw_text ( x , y , 24 , 32 , number . to_s , 2 )
end
elsif CONFIG_ITEM :: SHOW_NUMBERS == true
self . contents . draw_text ( x , y , 24 , 32 , 1.to_s , 2 )
end
#########################
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@ help_window . set_text ( self . item == nil ? "" : self . item . description )
end
end
#==============================================================================
# ** Window_Target
#------------------------------------------------------------------------------
# This window selects a use target for the actor on item and skill screens.
#==============================================================================
class Window_Target_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super ( 0 , 0 , 336 , 480 )
self . contents = Bitmap .new( width - 32 , height - 32 )
self . z += 10
self . windowskin = RPG :: Cache . windowskin ( CONFIG_ITEM :: WINDOWSKIN )
self . back_opacity = CONFIG_ITEM :: OPACITY
@ item_max = $game_party . actors . size
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self . contents . clear
for i in 0. .. $game_party . actors . size
x = 4
y = i * 116
actor = $game_party . actors [ i ]
draw_actor_name ( actor , x , y )
draw_actor_class ( actor , x + 144 , y )
draw_actor_level ( actor , x + 8 , y + 32 )
draw_actor_state ( actor , x + 8 , y + 64 )
draw_actor_hp ( actor , x + 152 , y + 32 )
draw_actor_sp ( actor , x + 152 , y + 64 )
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
# Cursor position -1 = all choices, -2 or lower = independent choice
# (meaning the user's own choice)
if @ index <= - 2
self . cursor_rect . set ( 0 , (@ index + 10 ) * 116 , self . width - 32 , 96 )
elsif @ index == - 1
self . cursor_rect . set ( 0 , 0 , self . width - 32 , @ item_max * 116 - 20 )
else
self . cursor_rect . set ( 0 , @ index * 116 , self . width - 32 , 96 )
end
end
end
#==============================================================================
# ** Window_Info
#------------------------------------------------------------------------------
# Zeigt einige infos an
#==============================================================================
class Window_Info < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super ( 0 , 0 , 640 , 480 )
self . contents = Bitmap .new( width - 32 , height - 32 )
self . windowskin = RPG :: Cache . windowskin ( "" )
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self . contents . clear
color = CONFIG_ITEM :: INFO_COLOR
text1 = CONFIG_ITEM :: ITEM_TEXT
text2 = CONFIG_ITEM :: EQUIP_TEXT
if $currentpage == nil or $currentpage == 0
$currentpage = 1
end
if $maxpage == nil or $maxpage == 0
$maxpage = 1
end
text3 = $currentpage . to_s + " / " + $maxpage . to_s
self . contents . font . color . set ( 255 , 255 , 255 )
self . contents . draw_text ( 448 , 352 - 96 + 4 , 100 , 64 , text3 , 2 )
self . contents . font . color . set ( color [ 0 ], color [ 1 ], color [ 2 ])
self . contents . draw_text ( 32 * 8 / 4 - 16 , 0 , 200 , 64 , text1 )
if CONFIG_ITEM :: EQUIPMENT == true
self . contents . draw_text ( 488 - 16 , 352 - 64 , 200 , 64 , text2 )
end
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
$currentpage = 1
@ spriteset = Spriteset_Map .new #<-------- Map wird als hintergrund angezeigt
# Make help window, item window
@ help_window = Window_Help_Item .new
@ item_window = Window_Item .new
if CONFIG_ITEM :: EQUIPMENT == true
@ actor = $game_party . actors [ 0 ]
@ equip_window = Window_EquipRight_Item .new(@ actor ) #<-Equip window wird angezeigt
end
# Associate help window
@ item_window . help_window = @ help_window
# Make target window (set to invisible / inactive)
@ target_window = Window_Target_Item .new
@ info_window = Window_Info .new
@ target_window . visible = false
@ target_window . active = false
# Execute transition
Graphics . transition
# Main loop
loop do
# Update game screen
Graphics . update
# Update input information
Input . update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics . freeze
# Dispose of windows
@ help_window . dispose
@ item_window . dispose
@ target_window . dispose
if CONFIG_ITEM :: EQUIPMENT == true
@ equip_window . dispose
end
@ info_window . dispose
@ spriteset . dispose #<------- Hintergrund wird gelöscht
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@ help_window . update
@ item_window . update
@ target_window . update
if CONFIG_ITEM :: EQUIPMENT == true
@ equip_window
end
@ info_window . update
# If item window is active: call update_item
if @ item_window . active
update_item
return
end
# If target window is active: call update_target
if @ target_window . active
update_target
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input . trigger ?( Input :: B )
# Play cancel SE
$game_system . se_play ( $data_system . cancel_se )
# Switch to menu screen oder zur map^^
if CONFIG_ITEM :: MAP_TRANSFER == true
$scene = Scene_Map .new
else
$scene = Scene_Menu .new( 0 )
end
return
end
# If C button was pressed
if Input . trigger ?( Input :: C )
# Get currently selected data on the item window
@ item = @ item_window . item
# If not a use item
unless @ item . is_a ?( RPG :: Item )
# Play buzzer SE
$game_system . se_play ( $data_system . buzzer_se )
return
end
# If it can't be used
unless $game_party . item_can_use ?(@ item . id )
# Play buzzer SE
$game_system . se_play ( $data_system . buzzer_se )
return
end
# Play decision SE
$game_system . se_play ( $data_system . decision_se )
# If effect scope is an ally
if @ item . scope >= 3
# Activate target window
@ item_window . active = false
@ target_window . x = ( 480 - 336 + 8 ) #(@item_window.index + 1) % 8 * 64# * 304
@ target_window . visible = true
@ target_window . active = true
# Set cursor position to effect scope (single / all)
if @ item . scope == 4 || @ item . scope == 6
@ target_window . index = - 1
else
@ target_window . index = 0
end
# If effect scope is other than an ally
else
# If command event ID is valid
if @ item . common_event_id > 0
# Command event call reservation
$game_temp . common_event_id = @ item . common_event_id
# Play item use SE
$game_system . se_play (@ item . menu_se )
# If consumable
if @ item . consumable
# Decrease used items by 1
$game_party . lose_item (@ item . id , 1 )
# Draw item window item
#@item_window.draw_item(@item_window.index)
end
# Switch to map screen
$scene = Scene_Map .new
return
end
end
return
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@ info_window . refresh
@ item_window . refresh
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input . trigger ?( Input :: B )
# Play cancel SE
$game_system . se_play ( $data_system . cancel_se )
# If unable to use because items ran out
unless $game_party . item_can_use ?(@ item . id )
# Remake item window contents
@ item_window . refresh
end
# Erase target window
@ item_window . active = true
@ target_window . visible = false
@ target_window . active = false
return
end
# If C button was pressed
if Input . trigger ?( Input :: C )
# If items are used up
if $game_party . item_number (@ item . id ) == 0
# Play buzzer SE
$game_system . se_play ( $data_system . buzzer_se )
return
end
# If target is all
if @ target_window . index == - 1
# Apply item effects to entire party
used = false
for i in $game_party . actors
used |= i . item_effect (@ item )
end
end
# If single target
if @ target_window . index >= 0
# Apply item use effects to target actor
target = $game_party . actors [@ target_window . index ]
used = target . item_effect (@ item )
end
# If an item was used
if used
# Play item use SE
$game_system . se_play (@ item . menu_se )
# If consumable
if @ item . consumable
# Decrease used items by 1
$game_party . lose_item (@ item . id , 1 )
# Redraw item window item
# Erase target window
#@item_window.draw_item(@item_window.index)
end
# Remake target window contents
@ target_window . refresh
# If all party members are dead
if $game_party . all_dead ?
# Switch to game over screen
$scene = Scene_Gameover .new
return
end
# If common event ID is valid
if @ item . common_event_id > 0
# Common event call reservation
$game_temp . common_event_id = @ item . common_event_id
# Switch to map screen
$scene = Scene_Map .new
return
end
if @ item . consumable
@ item_window . active = true
@ target_window . visible = false
@ target_window . active = false
return
end
end
# If item wasn't used
unless used
# Play buzzer SE
$game_system . se_play ( $data_system . buzzer_se )
end
return
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
end # Fertig :)
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=