Jump to content
Rpg²S Forum

*CMS - Un menu personalizzato


Spike92
 Share

Recommended Posts

Custom Menu System

Descrizione

Un menu personalizzato.

Autore

Mewsterus (traduzione e modifiche: Alex'94)

Istruzioni per l'uso

Create una nuova classe sopra il main e incollate:

 

 

 

# * Menù personalizzato: by mewsterus modificato da: Alex'94
# * Fate una nuova classe e chiamatela Custom_Menù
# * Dopodicchè avviate il gioco e...divertitevi!! :-)
#===============================================================================
# ¦ Window_Base
#-------------------------------------------------------------------------------
# Creato by mewsterus e tradotto e modificato da Alex'94
#===============================================================================

class Window_Base
    #-----------------------------------------------------------------------------
    # \\\\\\
    #-----------------------------------------------------------------------------
    def draw_actor_state(actor, x, y, width = 120)
        text = make_battler_state_text(actor, width, true)
        self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
        self.contents.draw_text(x, y, width, 32, text, 2)
    end
    #-----------------------------------------------------------------------------
    # \\\\\\\\\
    #-----------------------------------------------------------------------------
    def draw_actor_battler(actor, x, y)
        if $game_party.actors.size != 0
            bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
            src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
            self.contents.blt(x-(bitmap.width/2), y-bitmap.height, bitmap, src_rect)
        end
    end
    #-----------------------------------------------------------------------------
    # @ \\\\\\\\\
    #-----------------------------------------------------------------------------
    def draw_actor_exp(actor, x, y, width = 144)
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 48, 32, "Exp")
        self.contents.font.color = normal_color
        self.contents.draw_text(x + width - 48, y, 48, 32, actor.exp_s, 2)
    end
end

#===============================================================================
# ¦ Window_MenuStatus
#-------------------------------------------------------------------------------
# Creato by mewsterus modificato by Alex'94
#===============================================================================

class Window_MenuStatus < Window_Selectable
    #-----------------------------------------------------------------------------
    # @ Make the window
    #-----------------------------------------------------------------------------
    def initialize
        super(0, 240, 640, 0)
        self.z -= 30
        @column_max = 2
        self.active = false
        self.index = -1
    end
    #-----------------------------------------------------------------------------
    # @ Refresh the window
    #-----------------------------------------------------------------------------
    def refresh
        self.contents = Bitmap.new(608, 448)
        self.contents.clear
        @item_max = $game_party.actors.size
        for i in 0...$game_party.actors.size
            x = i % 2 * 400
            y = i / 2 * 232
            actor = $game_party.actors[i]
            draw_actor_battler(actor, x + 104, y + 208)
            draw_actor_name(actor, x, y)
            draw_actor_state(actor, x + 88, y)
            draw_actor_exp(actor, x, y + 20, 208)
            draw_actor_level(actor, x, y + 40)
            draw_actor_hp(actor, x, y + 168, 208)
            draw_actor_sp(actor, x, y + 188, 208)
            self.contents.draw_text(x + 64, y + 40, 144, 32, actor.class_name, 2)
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the cursor
    #-----------------------------------------------------------------------------
    def update_cursor_rect
        if @index < 0
            self.cursor_rect.empty
        else
            self.cursor_rect.set(@index%2*400-8, @index/2*232-8, 224, 232)
        end
    end
end

#===============================================================================
# ¦ Window_Play
#-------------------------------------------------------------------------------
# Written by mewsterus modificato da: Alex'94
#===============================================================================

class Window_Play < Window_Selectable
    #-----------------------------------------------------------------------------
    # @ Make the window
    #-----------------------------------------------------------------------------
    def initialize
        super(240, 240, 160, 0)
        self.z -= 20
        self.active = false
        self.index = -1
        self.back_opacity = 100
    end
    #-----------------------------------------------------------------------------
    # @ Refresh the window
    #-----------------------------------------------------------------------------
    def refresh
        self.contents = Bitmap.new(128, 448)
        #self.contents.font.name = $fontface
        #self.contents.font.size = $fontsize
        self.contents.clear
        cx = contents.text_size($data_system.words.gold).width
        self.contents.font.color = system_color
        self.contents.draw_text(0, 0, 128, 32, "Tempo: ")
        self.contents.draw_text(128 - cx, 64, cx, 32, $data_system.words.gold, 2)
        self.contents.draw_text(0, 384, 128, 32, "Passi: ")
        @total_sec = Graphics.frame_count / Graphics.frame_rate
        hour = @total_sec / 60 / 60
        min = @total_sec / 60 % 60
        sec = @total_sec % 60
        text = sprintf("%02d:%02d:%02d", hour, min, sec)
        self.contents.font.color = normal_color
        self.contents.draw_text(0, 32, 128, 32, text, 2)
        self.contents.draw_text(0, 64, 126 - cx, 32, $game_party.gold.to_s, 2)
        self.contents.font.color = normal_color
        self.contents.draw_text(0, 416, 128, 32, $game_party.steps.to_s, 2)
        if $location_enabled
            self.contents.draw_text(0,352,128,32,$game_map.name.delete("*").to_s,2)
            self.contents.font.color = system_color
            self.contents.draw_text(0,320,128,32,"Location")
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the cursor
    #-----------------------------------------------------------------------------
    def update_cursor_rect
        if @index < 0
            self.cursor_rect.empty
        else
            self.cursor_rect.set(@index%2*400-8, @index/2*232-8, 224, 232)
        end
    end
end

#===============================================================================
# ¦ Scene_Menu
#-------------------------------------------------------------------------------
# Creato by mewsterus Modificato by Alex'94
#===============================================================================

class Scene_Menu
    #-----------------------------------------------------------------------------
    # @ Accept index
    #-----------------------------------------------------------------------------
    def initialize(menu_index = 0, equip_index = 0)
        @menu_index = menu_index
        @equip_index = equip_index
    end
    #-----------------------------------------------------------------------------
    # @ Main loop
    #-----------------------------------------------------------------------------
    def main
        # @sprite = Spriteset_Map.new
        @bg_window = Window_Base.new(320, 0, 0, 480)
        s1 = $data_system.words.item
        s2 = $data_system.words.skill
        s3 = $data_system.words.equip
        s4 = "Stato"
        s5 = "Salva"
        s6 = "Esci Dal Gioco"
        @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
        @command_window.index = @menu_index
        @command_window.opacity = 0
        @command_window.x = 240
        @command_window.y = 96
        @command_window.z -= 10
        @command_window.visible = false
        if $game_party.actors.size == 0
            @command_window.disable_item(0)
            @command_window.disable_item(1)
            @command_window.disable_item(2)
            @command_window.disable_item(3)
        end
        if $game_system.save_disabled
            @command_window.disable_item(4)
        end
        @help_window = Window_Help.new
        @help_window.visible = false
        @help_window.back_opacity = 100
        @status_window = Window_MenuStatus.new
        @play_window = Window_Play.new
        if $itemdrop_enabled
            @itemdrop = Window_Command.new(160, ["Basilare", "Equipaggiamento", "Cerca"])
        else
            @itemdrop = Window_Base.new(240, 144, 160, 128)
        end
        @itemdrop.x = 240
        @itemdrop.y = 144
        @itemdrop.z -= 5
        @itemdrop.active = false
        @itemdrop.opacity = 0
        @itemdrop.contents_opacity = 0
        Graphics.transition
        loop do
            Graphics.update
            Input.update
            if @status_window.y > 0
                @status_window.y -= 16
                @status_window.height += 32
                @play_window.y -= 16
                @play_window.height += 32
            else
                @command_window.visible = true
                unless @refreshed
                    @status_window.refresh
                    @refreshed = true
                end
                update
                if @resize_item
                    if @bg_window.width < 640
                        @bg_window.x -= 16
                        @bg_window.width += 32
                    else
                        @resize_item = false
                        if $itemdrop_enabled
                            @item_window = Window_Item.new(@itemdrop.index + 20)
                        else
                            @item_window = Window_Item.new
                        end
                        @item_window.help_window = @help_window
                        @item_window.active = true
                        @item_window.x = 0
                        @item_window.contents_opacity = 255
                        @item_window.back_opacity = 100
                        @item_window.opacity = 255
                        @target_window = Window_Target.new
                        @target_window.active = false
                        @target_window.x = 320
                        @target_window.contents_opacity = 255
                        @target_window.opacity = 255
                        unless $ipm_enabled
                            @target_window.visible = false
                        end
                        if $itemdrop_enabled
                            if @itemdrop.index + 20 > 20
                                @item_window.width = 640
                                @item_window.column_max = 2
                                @target_window.visible = false
                            end
                        end
                        @help_window.visible = true
                        @itemdrop.opacity = 0
                        @itemdrop.contents_opacity = 0
                    end
                end
                if @resize_skill
                    if @bg_window.width < 640
                        @bg_window.x -= 16
                        @bg_window.width += 32
                    else
                        @resize_skill = false
                        @actor = $game_party.actors[@status_window.index]
                        @skillstatus_window = Window_SkillStatus.new(@actor)
                        @skillstatus_window.contents_opacity = 255
                        @skillstatus_window.back_opacity = 100
                        @skillstatus_window.opacity = 255
                        @skillstatus_window.x = 0
                        @skill_window = Window_Skill.new(@actor)
                        @skill_window.help_window = @help_window
                        @skill_window.contents_opacity = 255
                        @skill_window.back_opacity = 100
                        @skill_window.opacity = 255
                        if $ipm_enabled
                            @skill_window.y = 184
                            @skilltarget_window = Window_Target.new(@status_window.index)
                        else
                            @skill_window.y = 128
                            @skilltarget_window = Window_Target.new
                        end
                        @skilltarget_window.active = false
                        @skilltarget_window.contents_opacity = 255
                        @skilltarget_window.opacity = 255
                        @skilltarget_window.x = 320
                        @help_window.visible = true
                        unless $ipm_enabled
                            @skilltarget_window.visible = false
                        end
                    end
                end
                if @resize_equip
                    if @bg_window.width < 640
                        @bg_window.x -= 16
                        @bg_window.width += 32
                    else
                        @resize_equip = false
                        @actor = $game_party.actors[@status_window.index]
                        @equiphelp_window = Window_Help.new
                        @equiphelp_window.back_opacity = 100
                        @left_window = Window_EquipLeft.new(@actor)
                        @left_window.contents_opacity = 255
                        @left_window.back_opacity = 100
                        @left_window.opacity = 255
                        @left_window.x = 0
                        @right_window = Window_EquipRight.new(@actor)
                        @right_window.help_window = @equiphelp_window
                        @right_window.index = @equip_index
                        @right_window.contents_opacity = 255
                        @right_window.back_opacity = 100
                        @right_window.opacity = 255
                        @right_window.y = 64
                        @item_window1 = Window_EquipItem.new(@actor, 0)
                        @item_window2 = Window_EquipItem.new(@actor, 1)
                        @item_window3 = Window_EquipItem.new(@actor, 2)
                        @item_window4 = Window_EquipItem.new(@actor, 3)
                        @item_window5 = Window_EquipItem.new(@actor, 4)
                        @item_window1.help_window = @equiphelp_window
                        @item_window2.help_window = @equiphelp_window
                        @item_window3.help_window = @equiphelp_window
                        @item_window4.help_window = @equiphelp_window
                        @item_window5.help_window = @equiphelp_window
                        @item_window1.back_opacity = 100
                        @item_window2.back_opacity = 100
                        @item_window3.back_opacity = 100
                        @item_window4.back_opacity = 100
                        @item_window5.back_opacity = 100
                        if $ipm_enabled
                            @commands = ["Equippaggia", "Opzionale", "Rimuovi", "Svuota", "Annulla"]
                            @equip_window = Window_SideCommand.new(@commands)
                            @equip_window.back_opacity = 100
                            @equip_window.height = 64
                            @equiphelp_window.y = 416
                            @right_window.index = -1
                            @blank_window = Window_Base.new(272, 256, 368, 160)
                            @blank_window.active = false
                            @blank_window.back_opacity = 100
                        end
                        equip_refresh
                    end
                end
                if @resize_status
                    if @bg_window.width < 448
                        @bg_window.x -= 16
                        @bg_window.width += 32
                    elsif @bg_window.width < 640 and not $ipm_enabled
                        @bg_window.x -= 16
                        @bg_window.width += 32
                    else
                        @resize_status = false
                        @actor = $game_party.actors[@status_window.index]
                        @playerstatus_window = Window_Status.new(@actor)
                        @playerstatus_window.contents_opacity = 255
                        @playerstatus_window.opacity = 255
                        @playerstatus_window.y = 0
                    end
                end
                if @resize_save
                    if @help_window.x < 0
                        @help_window.x += 64
                        @savefile_windows[0].x -= 64
                        @savefile_windows[1].x += 64
                        @savefile_windows[2].x -= 64
                        @savefile_windows[3].x += 64
                    else
                        @resize_save = false
                        @savefile_windows_active = true
                    end
                end
                if @resize_back
                    @status_window.index = -1
                    if @bg_window.width > 0
                        @bg_window.x += 16
                        @bg_window.width -= 32
                    else
                        @resize_back = false
                        @command_window.active = true
                    end
                end
            end
            if $scene != self
                break
            end
        end
        @bg_window.dispose
        @command_window.dispose
        @help_window.dispose
        @status_window.cursor_rect.empty
        @status_window.contents.clear
        @status_window.contents = nil
        @play_window.contents.clear
        @play_window.contents = nil
        for i in 0..20
            @status_window.y += 16
            @status_window.height -= 32
            @play_window.y += 16
            @play_window.height -= 32
            @itemdrop.opacity -= 25
            @itemdrop.contents_opacity -= 25
            Graphics.update
        end
        Graphics.freeze
        # @sprite.dispose
        @status_window.dispose
        @itemdrop.dispose
    end
    #-----------------------------------------------------------------------------
    # @ Update the scene
    #-----------------------------------------------------------------------------
    def update
        @help_window.update
        @command_window.update
        @status_window.update
        @play_window.update
        @play_window.refresh
        @itemdrop.update
        if @command_window.active
            update_command
            return
        end
        if @status_window.active
            update_status
            return
        end
        if @itemdrop.active
            update_itemdrop
            return
        end
        if @item_window != nil
            @item_window.update
            @target_window.update
            if @item_window.active
                update_item
                return
            end
            if @target_window.active
                update_target
                return
            end
        end
        if @skill_window != nil
            @skill_window.update
            @skillstatus_window.update
            @skilltarget_window.update
            if @skill_window.active
                update_skill
                return
            end
            if @skilltarget_window.active
                update_skilltarget
                return
            end
            if @skillstatus_window.active
                update_skillstatus
                return
            end
        end
        if @left_window != nil
            @equiphelp_window.update
            @left_window.update
            @right_window.update
            @eitem_window.update
            equip_refresh
            if $ipm_enabled
                @equip_window.update
                if @equip_window.active
                    update_equip
                    return
                end
            end
            if @right_window.active
                update_right
                return
            end
            if @eitem_window.active
                update_eitem
                return
            end
        end
        if @playerstatus_window != nil
            @playerstatus_window.update
            update_playerstatus
        end
        if @savefile_windows != nil
            @help_window.update
            for i in @savefile_windows
                i.update
            end
            if @savefile_windows_active
                update_save
            end
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the command window
    #-----------------------------------------------------------------------------
    def update_command
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            $scene = Scene_Map.new
            return
        end
        if Input.trigger?(Input::C)
            if $game_party.actors.size == 0 and @command_window.index < 4
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            case @command_window.index
            when 0
                $game_system.se_play($data_system.decision_se)
                if $itemdrop_enabled
                    loop do
                        if @itemdrop.opacity < 250
                            @itemdrop.opacity += 25
                            @itemdrop.contents_opacity += 25
                        else
                            break
                        end
                        Graphics.update
                    end
                    @command_window.active = false
                    @itemdrop.active = true
                    return
                end
                @command_window.active = false
                @resize_item = true
            when 1
                $game_system.se_play($data_system.decision_se)
                @command_window.active = false
                @status_window.active = true
                @status_window.index = 0
            when 2
                $game_system.se_play($data_system.decision_se)
                @command_window.active = false
                @status_window.active = true
                @status_window.index = 0
            when 3
                $game_system.se_play($data_system.decision_se)
                @command_window.active = false
                @status_window.active = true
                @status_window.index = 0
            when 4
                if $game_system.save_disabled
                    $game_system.se_play($data_system.buzzer_se)
                    return
                end
                $game_system.se_play($data_system.decision_se)
                @help_window.set_text("Dove vuoi salvare??", 1)
                @help_window.back_opacity = 255
                @help_window.x = -640
                @savefile_windows = []
                for i in 0..3
                    if $ipm_enabled
                        @savefile_windows.push(Window_Save.new(i))
                    else
                        @savefile_windows.push(Window_SaveFile.new(i, nil))
                    end
                    @savefile_windows[i].back_opacity = 255
                    @savefile_windows[i].opacity = 255
                end
                @file_index = $game_temp.last_file_index
                @savefile_windows[@file_index].selected = true
                @savefile_windows[0].x = 640
                @savefile_windows[1].x = -640
                @savefile_windows[2].x = 640
                @savefile_windows[3].x = -640
                @command_window.active = false
                @resize_save = true
            when 5
                $game_system.se_play($data_system.decision_se)
                $scene = Scene_End.new
            end
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the status window
    #-----------------------------------------------------------------------------
    def update_status
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            @command_window.active = true
            @status_window.active = false
            @status_window.index = -1
            return
        end
        if Input.trigger?(Input::C)
            @actor_index = @status_window.index
            case @command_window.index
            when 1
                if $game_party.actors[@status_window.index].restriction >= 2
                    $game_system.se_play($data_system.buzzer_se)
                    return
                end
                $game_system.se_play($data_system.decision_se)
                @status_window.active = false
                @resize_skill = true
            when 2
                $game_system.se_play($data_system.decision_se)
                @status_window.active = false
                @resize_equip = true
            when 3
                $game_system.se_play($data_system.decision_se)
                @status_window.active = false
                @resize_status = true
            end
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the itemdrop window
    #-----------------------------------------------------------------------------
    def update_itemdrop
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            loop do
                if @itemdrop.opacity > 0
                    @itemdrop.opacity -= 25
                    @itemdrop.contents_opacity -= 25
                else
                    break
                end
                Graphics.update
            end
            @itemdrop.active = false
            @command_window.active = true
            return
        end
        if Input.trigger?(Input::C)
            $game_system.se_play($data_system.decision_se)
            @itemdrop.active = false
            @resize_item = true
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the item window
    #-----------------------------------------------------------------------------
    def update_item
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            @item_window.dispose
            @target_window.dispose
            @item_window = nil
            @target_window = nil
            @help_window.visible = false
            @resize_back = true
            return
        end
        if Input.trigger?(Input::C)
            @item = @item_window.item
            unless @item.is_a?(RPG::Item)
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            unless $game_party.item_can_use?(@item.id)
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            $game_system.se_play($data_system.decision_se)
            if @item.scope >= 3
                @item_window.active = false
                unless $ipm_enabled
                    @target_window.x = (@item_window.index + 1) % 2 * 304
                    @target_window.visible = true
                end
                @target_window.active = true
                if @item.scope == 4 || @item.scope == 6
                    @target_window.index = -1
                else
                    @target_window.index = 0
                end
            else
                if @item.common_event_id > 0
                    $game_temp.common_event_id = @item.common_event_id
                    $game_system.se_play(@item.menu_se)
                    if @item.consumable
                        $game_party.lose_item(@item.id, 1)
                        @item_window.draw_item(@item_window.index)
                    end
                    $scene = Scene_Map.new
                    return
                end
            end
            return
        end
        if Input.trigger?(Input::R) and $itemdrop_enabled
            $game_system.se_play($data_system.cursor_se)
            @itemdrop.index = (@itemdrop.index + 1) % 3
            @item_window.dispose
            @target_window.dispose
            @resize_item = true
            return
        end
        if Input.trigger?(Input::L) and $itemdrop_enabled
            $game_system.se_play($data_system.cursor_se)
            @itemdrop.index = (@itemdrop.index + 2) % 3
            @item_window.dispose
            @target_window.dispose
            @resize_item = true
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the target window
    #-----------------------------------------------------------------------------
    def update_target
        if $game_party.item_number(@item.id) == 0
            @target_window.active = false
            @item_window.refresh
            @item_window.active = true
            unless $ipm_enabled
                @target_window.visible = false
            end
            return
        end
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            unless $game_party.item_can_use?(@item.id)
                @item_window.refresh
            end
            @item_window.active = true
            unless $ipm_enabled
                @target_window.visible = false
            end
            @target_window.active = false
            return
        end
        if Input.trigger?(Input::C)
            if $game_party.item_number(@item.id) == 0
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            if @target_window.index == -1
                used = false
                for i in $game_party.actors
                    used |= i.item_effect(@item)
                end
            end
            if @target_window.index >= 0
                target = $game_party.actors[@target_window.index]
                used = target.item_effect(@item)
            end
            if used
                $game_system.se_play(@item.menu_se)
                if @item.consumable
                    $game_party.lose_item(@item.id, 1)
                    @item_window.draw_item(@item_window.index)
                end
                @target_window.refresh
                if $game_party.all_dead?
                    $scene = Scene_Gameover.new
                    return
                end
                if @item.common_event_id > 0
                    $game_temp.common_event_id = @item.common_event_id
                    $scene = Scene_Map.new
                    return
                end
            end
            unless used
                $game_system.se_play($data_system.buzzer_se)
            end
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the skill window
    #-----------------------------------------------------------------------------
    def update_skill
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            @skill_window.dispose
            @skillstatus_window.dispose
            @skilltarget_window.dispose
            @skill_window = nil
            @skillstatus_window = nil
            @skilltarget_window = nil
            @help_window.visible = false
            @resize_back = true
            return
        end
        if Input.trigger?(Input::C)
            @skill = @skill_window.skill
            if @skill == nil or not @actor.skill_can_use?(@skill.id)
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            $game_system.se_play($data_system.decision_se)
            if @skill.scope >= 3
                @skill_window.active = false
                unless $ipm_enabled
                    @skilltarget_window.x = (@skill_window.index + 1) % 2 * 304
                    @skilltarget_window.visible = true
                end
                @skilltarget_window.active = true
                if @skill.scope == 4 || @skill.scope == 6
                    @skilltarget_window.index = -1
                    if $ipm_enabled
                        @skillstatus_window.selected = true
                        @skillstatus_window.active = true
                    end
                elsif @skill.scope == 7
                    if $ipm_enabled
                        @skillstatus_window.selected = true
                        @skillstatus_window.active = true
                    else
                        @skilltarget_window.index = @actor_index - 10
                    end
                else
                    @skilltarget_window.index = 0
                end
            else
                if @skill.common_event_id > 0
                    $game_temp.common_event_id = @skill.common_event_id
                    $game_system.se_play(@skill.menu_se)
                    @actor.sp -= @skill.sp_cost
                    @skillstatus_window.refresh
                    @skill_window.refresh
                    @skilltarget_window.refresh
                    $scene = Scene_Map.new
                    return
                end
            end
            return
        end
        if Input.trigger?(Input::R)
            $game_system.se_play($data_system.cursor_se)
            @status_window.index = (@status_window.index+1)%$game_party.actors.size
            @skill_window.dispose
            @skillstatus_window.dispose
            @skilltarget_window.dispose
            @resize_skill = true
            return
        end
        if Input.trigger?(Input::L)
            $game_system.se_play($data_system.cursor_se)
            @status_window.index = (@status_window.index-1)%$game_party.actors.size
            @skill_window.dispose
            @skillstatus_window.dispose
            @skilltarget_window.dispose
            @resize_skill = true
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the skill target window
    #-----------------------------------------------------------------------------
    def update_skilltarget
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            @skill_window.active = true
            @skilltarget_window.active = false
            if $ipm_enabled
                @skillstatus_window.selected = false
                @skillstatus_window.active = false
            else
                @skilltarget_window.visible = false
            end
            return
        end
        if Input.trigger?(Input::C)
            unless @actor.skill_can_use?(@skill.id)
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            if @skilltarget_window.index == -1
                used = false
                for i in $game_party.actors
                    used |= i.skill_effect(@actor, @skill)
                end
            end
            if @skilltarget_window.index <= -2
                target = $game_party.actors[@skilltarget_window.index + 10]
                used = target.skill_effect(@actor, @skill)
            end
            if @skilltarget_window.index >= 0
                if @skilltarget_window.index >= @actor_index and $ipm_enabled
                    target = $game_party.actors[@skilltarget_window.index + 1]
                else
                    target = $game_party.actors[@skilltarget_window.index]
                end
                used = target.skill_effect(@actor, @skill)
            end
            if used
                $game_system.se_play(@skill.menu_se)
                @actor.sp -= @skill.sp_cost
                @skillstatus_window.refresh
                @skill_window.refresh
                @skilltarget_window.refresh
                if $game_party.all_dead?
                    $scene = Scene_Gameover.new
                    return
                end
                if @skill.common_event_id > 0
                    $game_temp.common_event_id = @skill.common_event_id
                    $scene = Scene_Map.new
                    return
                end
            end
            unless used
                $game_system.se_play($data_system.buzzer_se)
            end
            return
        end
        if $ipm_enabled
            if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::LEFT)
                $game_system.se_play($data_system.cursor_se)
                @skilltarget_window.active = false
                @skillstatus_window.active = true
                @skillstatus_window.selected = true
                return
            end
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the skill status window
    #-----------------------------------------------------------------------------
    def update_skillstatus
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            @skill_window.active = true
            @skilltarget_window.active = false
            @skillstatus_window.selected = false
            return
        end
        if Input.trigger?(Input::C)
            unless @actor.skill_can_use?(@skill.id)
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            if @skilltarget_window.index == -1
                used = false
                for i in $game_party.actors
                    used |= i.skill_effect(@actor, @skill)
                end
            end
            if @skilltarget_window.index <= -2
                target = @actor
                used = target.skill_effect(@actor, @skill)
            end
            if @skilltarget_window.index >= 0
                target = @actor
                used = target.skill_effect(@actor, @skill)
            end
            if used
                $game_system.se_play(@skill.menu_se)
                @actor.sp -= @skill.sp_cost
                @skillstatus_window.refresh
                @skill_window.refresh
                @skilltarget_window.refresh
                if $game_party.all_dead?
                    $scene = Scene_Gameover.new
                    return
                end
                if @skill.common_event_id > 0
                    $game_temp.common_event_id = @skill.common_event_id
                    $scene = Scene_Map.new
                    return
                end
            end
            unless used
                $game_system.se_play($data_system.buzzer_se)
            end
            return
        end
        if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::LEFT)
            if @skill.scope == 7
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            $game_system.se_play($data_system.cursor_se)
            @skillstatus_window.active = false
            @skillstatus_window.selected = false
            @skilltarget_window.active = true
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Refresh the equip screen
    #-----------------------------------------------------------------------------
    def equip_refresh
        unless @remove
            @item_window1.visible = (@right_window.index == 0)
            @item_window2.visible = (@right_window.index == 1)
            @item_window3.visible = (@right_window.index == 2)
            @item_window4.visible = (@right_window.index == 3)
            @item_window5.visible = (@right_window.index == 4)
        end
        item1 = @right_window.item
        case @right_window.index
        when -2
            @eitem_window = @blank_window
        when -1
            @eitem_window = @blank_window
        when 0
            @eitem_window = @item_window1
            newmode = 0
        when 1
            @eitem_window = @item_window2
            newmode = 1
        when 2
            @eitem_window = @item_window3
            newmode = 1
        when 3
            @eitem_window = @item_window4
            newmode = 1
        when 4
            @eitem_window = @item_window5
            newmode = 1
        end
        if @remove
            @eitem_window = @blank_window
        end
        if $ipm_enabled
            if newmode != @left_window.mode
                @left_window.mode = newmode
                @left_window.refresh
            end
            if @eitem_window.active or @remove
                if @eitem_window.active
                    item2 = @eitem_window.item
                end
                last_hp = @actor.hp
                last_sp = @actor.sp
                old_atk = @actor.atk
                old_pdef = @actor.pdef
                old_mdef = @actor.mdef
                old_str = @actor.str
                old_dex = @actor.dex
                old_agi = @actor.agi
                old_int = @actor.int
                old_eva = @actor.eva
                @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
                new_atk = @actor.atk
                new_pdef = @actor.pdef
                new_mdef = @actor.mdef
                new_str = @actor.str
                new_dex = @actor.dex
                new_agi = @actor.agi
                new_int = @actor.int
                new_eva = @actor.eva
                @left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
                @left_window.changes[0] = new_atk - old_atk
                @left_window.changes[1] = new_pdef - old_pdef
                @left_window.changes[2] = new_mdef - old_mdef
                @left_window.changes[3] = new_str - old_str
                @left_window.changes[4] = new_dex - old_dex
                @left_window.changes[5] = new_agi - old_agi
                @left_window.changes[6] = new_int - old_int
                @left_window.changes[7] = new_eva - old_eva
                @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
                @actor.hp = last_hp
                @actor.sp = last_sp
                @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
                new_dex, new_agi, new_int, new_eva)
            else
                @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
            end
        else
            if @eitem_window.active
                item2 = @eitem_window.item
                last_hp = @actor.hp
                last_sp = @actor.sp
                @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
                new_atk = @actor.atk
                new_pdef = @actor.pdef
                new_mdef = @actor.mdef
                @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
                @actor.hp = last_hp
                @actor.sp = last_sp
                @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
            else
                @left_window.set_new_parameters(nil, nil, nil)
            end
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the equip command window
    #-----------------------------------------------------------------------------
    def update_equip
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            @equiphelp_window.dispose
            @equip_window.dispose
            @left_window.dispose
            @right_window.dispose
            @blank_window.dispose
            @item_window1.dispose
            @item_window2.dispose
            @item_window3.dispose
            @item_window4.dispose
            @item_window5.dispose
            @equiphelp_window = nil
            @equip_window = nil
            @left_window = nil
            @right_window = nil
            @blank_window = nil
            @item_window1 = nil
            @item_window2 = nil
            @item_window3 = nil
            @item_window4 = nil
            @item_window5 = nil
            @resize_back = true
            return
        end
        if Input.trigger?(Input::C)
            $game_system.se_play($data_system.decision_se)
            case @equip_window.index
            when 0
                @equip_window.active = false
                @right_window.active = true
                @right_window.index = @equip_index
            when 1
                optimize
                @left_window.refresh
                @right_window.refresh
                @item_window1.refresh
                @item_window2.refresh
                @item_window3.refresh
                @item_window4.refresh
                @item_window5.refresh
            when 2
                @remove = true
                @equip_window.active = false
                @right_window.active = true
                @right_window.index = @equip_index
            when 3
                for i in 0..4
                    @actor.equip(i, 0)
                end
                @left_window.refresh
                @right_window.refresh
                @item_window1.refresh
                @item_window2.refresh
                @item_window3.refresh
                @item_window4.refresh
                @item_window5.refresh
            when 4
                @equiphelp_window.dispose
                @equip_window.dispose
                @left_window.dispose
                @right_window.dispose
                @blank_window.dispose
                @item_window1.dispose
                @item_window2.dispose
                @item_window3.dispose
                @item_window4.dispose
                @item_window5.dispose
                @equiphelp_window = nil
                @equip_window = nil
                @left_window = nil
                @right_window = nil
                @blank_window = nil
                @item_window1 = nil
                @item_window2 = nil
                @item_window3 = nil
                @item_window4 = nil
                @item_window5 = nil
                @resize_back = true
            end
            return
        end
        if Input.trigger?(Input::R)
            $game_system.se_play($data_system.cursor_se)
            @status_window.index = (@status_window.index+1) % $game_party.actors.size
            @equiphelp_window.dispose
            @equip_window.dispose
            @left_window.dispose
            @right_window.dispose
            @blank_window.dispose
            @item_window1.dispose
            @item_window2.dispose
            @item_window3.dispose
            @item_window4.dispose
            @item_window5.dispose
            @resize_equip = true
            return
        end
        if Input.trigger?(Input::L)
            $game_system.se_play($data_system.cursor_se)
            @status_window.index = (@status_window.index-1) % $game_party.actors.size
            @equiphelp_window.dispose
            @equip_window.dispose
            @left_window.dispose
            @right_window.dispose
            @blank_window.dispose
            @item_window1.dispose
            @item_window2.dispose
            @item_window3.dispose
            @item_window4.dispose
            @item_window5.dispose
            @resize_equip = true
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the right window
    #-----------------------------------------------------------------------------
    def update_right
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            if $ipm_enabled
                @right_window.active = false
                @equip_window.active = true
                if @right_window.index >= 0
                    @equip_index = @right_window.index
                end
                @right_window.index = -1
                @remove = false
                @equiphelp_window.set_text("")
                @left_window.refresh
                return
            end
            @equiphelp_window.dispose
            @left_window.dispose
            @right_window.dispose
            @item_window1.dispose
            @item_window2.dispose
            @item_window3.dispose
            @item_window4.dispose
            @item_window5.dispose
            @equiphelp_window = nil
            @left_window = nil
            @right_window = nil
            @item_window1 = nil
            @item_window2 = nil
            @item_window3 = nil
            @item_window4 = nil
            @item_window5 = nil
            @resize_back = true
            return
        end
        if Input.trigger?(Input::C)
            if @remove
                $game_system.se_play($data_system.decision_se)
                @actor.equip(@right_window.index, 0)
                @left_window.refresh
                @right_window.refresh
                return
            end
            if @actor.equip_fix?(@right_window.index)
                $game_system.se_play($data_system.buzzer_se)
                return
            end
            if $ipm_enabled
                if @eitem_window.data.size == 0
                    $game_system.se_play($data_system.buzzer_se)
                    return
                end
            end
            $game_system.se_play($data_system.decision_se)
            @right_window.active = false
            @eitem_window.active = true
            @eitem_window.index = 0
            return
        end
        if Input.trigger?(Input::R) and not $ipm_enabled
            $game_system.se_play($data_system.cursor_se)
            @status_window.index = (@status_window.index+1) % $game_party.actors.size
            @equiphelp_window.dispose
            @equip_window.dispose
            @left_window.dispose
            @right_window.dispose
            @blank_window.dispose
            @item_window1.dispose
            @item_window2.dispose
            @item_window3.dispose
            @item_window4.dispose
            @item_window5.dispose
            @resize_equip = true
            return
        end
        if Input.trigger?(Input::L) and not $ipm_enabled
            $game_system.se_play($data_system.cursor_se)
            @status_window.index = (@status_window.index-1) % $game_party.actors.size
            @equiphelp_window.dispose
            @equip_window.dispose
            @left_window.dispose
            @right_window.dispose
            @blank_window.dispose
            @item_window1.dispose
            @item_window2.dispose
            @item_window3.dispose
            @item_window4.dispose
            @item_window5.dispose
            @resize_equip = true
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the equip item window
    #-----------------------------------------------------------------------------
    def update_eitem
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            @right_window.active = true
            @eitem_window.active = false
            @eitem_window.index = -1
            return
        end
        if Input.trigger?(Input::C)
            $game_system.se_play($data_system.equip_se)
            item = @eitem_window.item
            @actor.equip(@right_window.index, item.id)
            @right_window.active = true
            @eitem_window.active = false
            @eitem_window.index = -1
            @right_window.refresh
            @eitem_window.refresh
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Optimize equipment (by RPGAdvocate)
    #-----------------------------------------------------------------------------
    def optimize
        object = $data_weapons[@actor.weapon_id]
        optimal = object.id
        current = 0.00
        if @actor.weapon_id != 0
            current = object.atk
        else
            optimal = 0
        end
        max_eval = current
        @actor.equip(0, 0)
        flag = false
        zero_flag = true
        for weapon in $data_weapons
            if !flag
                flag = true
                next
            end
            evaluation = weapon.atk
            if evaluation > 0
                zero_flag = false
            end
            if @actor.equippable?(weapon) &&
                $game_party.weapon_number(weapon.id) > 0 && evaluation > max_eval
                max_eval = evaluation
                optimal = weapon.id
            end
        end
        if zero_flag
            optimal = 0
        end
        @actor.equip(0, optimal)
        not_equipped = false
        for i in 1..4
            case i
            when 1
                if @actor.armor1_id == 0
                    not_equipped = true
                else
                    object = $data_armors[@actor.armor1_id]
                end
            when 2
                if @actor.armor2_id == 0
                    not_equipped = true
                else
                    object = $data_armors[@actor.armor2_id]
                end
            when 3
                if @actor.armor3_id == 0
                    not_equipped = true
                else
                    object = $data_armors[@actor.armor3_id]
                end
            when 4
                if @actor.armor4_id == 0
                    not_equipped = true
                else
                    object = $data_armors[@actor.armor4_id]
                end
            end
            optimal = object.id
            current = 0.00
            if not_equipped = false
                current = object.pdef * 0.75 + object.mdef * 0.25
            else
                optimal = 0
            end
            max_eval = current
            @actor.equip(i, 0)
            flag = false
            zero_flag = true
            for armor in $data_armors
                if !flag
                    flag = true
                    next
                end
                if armor.kind != i-1
                    next
                end
                evaluation = armor.pdef * 0.75 + armor.mdef * 0.25
                if evaluation > 0
                    zero_flag = false
                end
                if @actor.equippable?(armor) &&
                    $game_party.armor_number(armor.id) > 0 && evaluation > max_eval
                    max_eval = evaluation
                    optimal = armor.id
                end
            end
            if zero_flag
                optimal = 0
            end
            @actor.equip(i, optimal)
        end
    end
    #----------------------------------------------------------------------------
    # @ Update the large status window
    #----------------------------------------------------------------------------
    def update_playerstatus
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            @playerstatus_window.dispose
            @playerstatus_window = nil
            @resize_back = true
            return
        end
        if Input.trigger?(Input::R)
            $game_system.se_play($data_system.cursor_se)
            @status_window.index = (@status_window.index+1) % $game_party.actors.size
            @playerstatus_window.dispose
            @resize_status = true
            return
        end
        if Input.trigger?(Input::L)
            $game_system.se_play($data_system.cursor_se)
            @status_window.index = (@status_window.index-1) % $game_party.actors.size
            @playerstatus_window.dispose
            @resize_status = true
            return
        end
    end
    #-----------------------------------------------------------------------------
    # @ Update the save screen
    #-----------------------------------------------------------------------------
    def update_save
        if Input.trigger?(Input::C)
            $game_system.se_play($data_system.save_se)
            file = File.open("Save#{@file_index + 1}.rxdata", "wb")
            characters = []
            for i in 0...$game_party.actors.size
                actor = $game_party.actors[i]
                characters.push([actor.character_name, actor.character_hue])
            end
            Marshal.dump(characters, file)
            Marshal.dump(Graphics.frame_count, file)
            $game_system.save_count += 1
            $game_system.magic_number = $data_system.magic_number
            Marshal.dump($game_system, file)
            Marshal.dump($game_switches, file)
            Marshal.dump($game_variables, file)
            Marshal.dump($game_self_switches, file)
            Marshal.dump($game_screen, file)
            Marshal.dump($game_actors, file)
            Marshal.dump($game_party, file)
            Marshal.dump($game_troop, file)
            Marshal.dump($game_map, file)
            Marshal.dump($game_player, file)
            file.close
            @savefile_windows[@file_index].refresh
            $game_temp.last_file_index = @file_index
            for i in 0..10
                @help_window.x += 64
                @savefile_windows[0].x -= 64
                @savefile_windows[1].x += 64
                @savefile_windows[2].x -= 64
                @savefile_windows[3].x += 64
                Graphics.update
            end
            @savefile_windows_active = false
            @command_window.active = true
            @help_window.back_opacity = 100
            @help_window.visible = false
            @help_window.x = 0
            return
        end
        if Input.trigger?(Input::B)
            $game_system.se_play($data_system.cancel_se)
            for i in 0..10
                @help_window.x += 64
                @savefile_windows[0].x -= 64
                @savefile_windows[1].x += 64
                @savefile_windows[2].x -= 64
                @savefile_windows[3].x += 64
                Graphics.update
            end
            @savefile_windows_active = false
            @command_window.active = true
            @help_window.back_opacity = 100
            @help_window.visible = false
            @help_window.x = 0
            return
        end
        if Input.repeat?(Input::DOWN)
            if Input.trigger?(Input::DOWN) or @file_index < 3
                $game_system.se_play($data_system.cursor_se)
                @savefile_windows[@file_index].selected = false
                @file_index = (@file_index + 1) % 4
                @savefile_windows[@file_index].selected = true
                return
            end
        end
        if Input.repeat?(Input::UP)
            if Input.trigger?(Input::UP) or @file_index > 0
                $game_system.se_play($data_system.cursor_se)
                @savefile_windows[@file_index].selected = false
                @file_index = (@file_index + 3) % 4
                @savefile_windows[@file_index].selected = true
                return
            end
        end
    end
end

 

 

 

Edited by Flame

Setta dei makeratori originali™ - SMO - #settadeimakeratorioriginali

 

 

<DarK-SePHiRoTH-> raga sono mancato un anno ma a quanto vedo mahun non ha ancora imparato a disegnare :O

 

<cip_e_ciop> picasso ha fatto per la pittura ciò che mahun ha fatto per i fumetti

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...