赞 | 153 |
VIP | 10 |
好人卡 | 39 |
积分 | 93 |
经验 | 146191 |
最后登录 | 2024-5-6 |
在线时间 | 2504 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 9280
- 在线时间
- 2504 小时
- 注册时间
- 2011-5-20
- 帖子
- 15389
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 chd114 于 2012-7-9 12:37 编辑
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # ■ Harts_Window_ItemTitle
- #==============================================================================
- class Harts_Window_ItemTitle < Window_Base
- def initialize
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
- end
- end
- #==============================================================================
- # ■ Harts_Window_ItemCommand
- #==============================================================================
- class Harts_Window_ItemCommand < Window_Selectable
- attr_accessor :commands
- #--------------------------------------------------------------------------
- # ● 初始化,生成commands窗口
- #--------------------------------------------------------------------------
- def initialize
- super(0, 64, 160, 352)
- @commands = []
- #————————生成commands窗口
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- push = true
- for com in @commands
- if com == $data_items[i].desc
- push = false
- end
- end
- if push == true
- @commands.push($data_items[i].desc)
- end
- end
- end
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- push = true
- for com in @commands
- if com == $data_weapons[i].desc
- push = false
- end
- end
- if push == true
- @commands.push($data_weapons[i].desc)
- end
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- push = true
- for com in @commands
- if com == $data_armors[i].desc
- push = false
- end
- end
- if push == true
- @commands.push($data_armors[i].desc)
- end
- end
- end
-
-
- if @commands == []
- @commands.push("")#普通物品")
- end
- @item_max = @commands.size
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- y = index * 32
- self.contents.draw_text(4, y, 128, 32, @commands[index])
- end
- #--------------------------------------------------------------------------
- # 只描绘原文字
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(@commands[self.index])
- end
- end
- #==============================================================================
- # ■ Window_Item
- #==============================================================================
- class Harts_Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def initialize
- super(160, 0, 480, 416)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def set_item(command)
- refresh
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0 and $data_items[i].desc == command
- @data.push($data_items[i])
- end
- end
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
- @data.push($data_weapons[i])
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
- @data.push($data_armors[i])
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def item_number
- return @item_max
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- #—— 取得具体物品数量 ——
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- #—— 给出物品的颜色 ——
- if item.is_a?(RPG::Item)
- if $game_party.item_can_use?(item.id)
- self.contents.font.color = text_color(item.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- else
- if item.is_a?(RPG::Weapon)#武器不能装备用灰色
- if $data_classes[$data_actors[$game_variables[1]+1].class_id].weapon_set.include?(item.id)
- self.contents.font.color = text_color(item.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- end
- if item.is_a?(RPG::Armor)#防具不能装备用灰色
- if $data_classes[$data_actors[$game_variables[1]+1].class_id].armor_set.include?(item.id)
- self.contents.font.color = text_color(item.name_color_66RPG)#normal_color
- else
- self.contents.font.color = disabled_color
- end
- end
- end
- x = 4
- y = index * 32
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y , bitmap, Rect.new(0, 0, 32, 32), opacity)#物品图标用32*32
- self.contents.draw_text(x + 40, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, "×", 1) if $game_party.item_number(item.id)>1
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) if $game_party.item_number(item.id)>1
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Harts_Scene_Item
- #==============================================================================
- class Scene_Item
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def main
- @itemtitle_window = Harts_Window_ItemTitle.new
- @itemcommand_window = Harts_Window_ItemCommand.new
- @command_index = @itemcommand_window.index
- @itemlist_window = Harts_Window_ItemList.new
- @itemlist_window.active = false
- @help_window = Window_Help.new
- @help_window.x = 0
- @help_window.y = 416
- @itemcommand_window.help_window = @help_window
- @itemlist_window.help_window = @help_window
- @target_window = Window_Target.new
- @target_window.visible = false
- @target_window.active = false
- @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @itemtitle_window.dispose
- @itemcommand_window.dispose
- @itemlist_window.dispose
- @help_window.dispose
- @target_window.dispose
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update
- @itemtitle_window.update
- @itemcommand_window.update
- @itemlist_window.update
- @help_window.update
- @target_window.update
- if @command_index != @itemcommand_window.index
- @command_index = @itemcommand_window.index
- @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
- end
- if @itemcommand_window.active
- update_itemcommand
- return
- end
- if @itemlist_window.active
- update_itemlist
- return
- end
- if @target_window.active
- update_target
- return
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_itemcommand
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- # $scene = Scene_Menu.new(1)
- return
- end
- if Input.trigger?(Input::C)
- if @itemlist_window.item_number == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @itemcommand_window.active = false
- @itemlist_window.active = true
- @itemlist_window.index = 0
- return
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_itemlist
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @itemcommand_window.active = true
- @itemlist_window.active = false
- @itemlist_window.index = 0
- @itemcommand_window.index = @command_index
- return
- end
- if Input.trigger?(Input::C)
- @item = @itemlist_window.item
-
- target_actor = $game_party.actors[0]#@item_target_window_equip.index]
- if target_actor.equippable?(@item)# and $game_party.item_can_equip?(target_actor,@item)
- $scene = Scene_Equip.new
- end
- # 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
- @itemlist_window.active = false
- @target_window.x = 304
- @target_window.visible = true
- @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
-
- # #下一句在使用物品时获得物品id
- $game_variables[20] = @item.id
-
- $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)
- @itemlist_window.draw_item(@itemlist_window.index)
- end
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_target
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- unless $game_party.item_can_use?(@item.id)
- @itemlist_window.refresh
- end
- @itemlist_window.active = true
- @target_window.visible = false
- @target_window.active = false
- @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
- 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)
- @itemlist_window.draw_item(@itemlist_window.index)
- @itemlist_window.set_item(@itemcommand_window.commands[@command_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
- end
- #==============================================================================
- # ■ RPG追加定义,使用@符号分类
- #==============================================================================
- module RPG
- class Weapon
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def desc
- desc = @description.split(/@/)[1]
- return desc != nil ? desc : "普通物品"
- end
- end
- class Item
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def desc
- desc = @description.split(/@/)[1]
- return desc != nil ? desc : "普通物品"
- end
- end
- class Armor
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def desc
- desc = @description.split(/@/)[1]
- return desc != nil ? desc : "普通物品"
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # ————————————————————————————————————
- # 本脚本来自www.66rpg.com,转载请保留此信息
- # ————————————————————————————————————
- #==============================================================================
- # ■ Window_Warehouse_Title
- #------------------------------------------------------------------------------
- # 仓库窗口:标题
- #==============================================================================
- class Window_Warehouse_Title < Window_Base
- def initialize
- super(0, 64, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 120, 32, "仓库", 1)
- end
- end
- #==============================================================================
- # ■ Window_Warehouse_Action
- #------------------------------------------------------------------------------
- # 仓库窗口:存取动作选择
- #==============================================================================
- class Window_Warehouse_Action < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(160, 64, 480, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- @item_max = 3
- @column_max = 3
- @commands = ["存入物品", "取出物品", "离开"]
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- x = 4 + index * 160
- self.contents.draw_text(x, 0, 128, 32, @commands[index])
- end
- end
- #==============================================================================
- # ■ Window_Warehouse_Sorting
- #------------------------------------------------------------------------------
- # 仓库窗口:物品分类
- #==============================================================================
- class Window_Warehouse_Sorting < Window_Selectable
- attr_accessor :commands
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 128, 160, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- if $Sorting != []
- @commands = $Sorting
- else
- @commands = []
- end
- #提取项目:例遍物品
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- push = true
- for com in @commands
- if com == $data_items[i].desc
- push = false
- end
- end
- if push == true
- @commands.push($data_items[i].desc)
- end
- end
- end
- #提取项目:例遍武器
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- push = true
- for com in @commands
- if com == $data_weapons[i].desc
- push = false
- end
- end
- if push == true
- @commands.push($data_weapons[i].desc)
- end
- end
- end
- #提取项目:例遍防具
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- push = true
- for com in @commands
- if com == $data_armors[i].desc
- push = false
- end
- end
- if push == true
- @commands.push($data_armors[i].desc)
- end
- end
- end
- #判断物品是否为空
- if @commands == []
- @commands.push("无任何物品")
- end
- @item_max = @commands.size
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # 更新画面
- #--------------------------------------------------------------------------
- def refresh(action = 0)
- self.contents.clear
- for i in 0...@item_max
- if action == 0
- draw_item(i, have_item(i))
- else
- draw_item(i, have_item_w(i))
- end
- end
- end
- #--------------------------------------------------------------------------
- # 描绘
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- y = index * 32
- self.contents.draw_text(4, y, 128, 32, @commands[index])
- end
- #--------------------------------------------------------------------------
- # 只描绘原文字
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(@commands[self.index])
- end
- #--------------------------------------------------------------------------
- # 判断分类下是否有内容
- #--------------------------------------------------------------------------
- def have_item(index)
- s = 0
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0 and $data_armors[i].desc == @commands[index]
- s += 1
- end
- end
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0 and $data_items[i].desc == @commands[index]
- s += 1
- end
- end
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == @commands[index]
- s += 1
- end
- end
-
- if s == 0
- return disabled_color
- else
- return normal_color
- end
- end
-
- def have_item_w(index)
- s = 0
- for i in 1...$data_armors.size
- if $game_party.get_warehouse(i,"A") > 0 and $data_armors[i].desc == @commands[index]
- s += 1
- end
- end
- for i in 1...$data_items.size
- if $game_party.get_warehouse(i,"I") > 0 and $data_items[i].desc == @commands[index]
- s += 1
- end
- end
- for i in 1...$data_weapons.size
- if $game_party.get_warehouse(i,"W") > 0 and $data_weapons[i].desc == @commands[index]
- s += 1
- end
- end
-
- if s == 0
- return disabled_color
- else
- return normal_color
- end
- end
- end
- #==============================================================================
- # ■ Window_Warehouse_Item
- #------------------------------------------------------------------------------
- # 仓库显示物品的窗口。
- #==============================================================================
- class Window_Warehouse_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # 初始化
- #--------------------------------------------------------------------------
- def initialize
- super(160, 128, 480, 352)
- refresh
- self.index = -1
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def set_item(command)
- refresh
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
- @data.push($data_armors[i])
- end
- end
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0 and $data_items[i].desc == command
- @data.push($data_items[i])
- end
- end
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
- @data.push($data_weapons[i])
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
-
- def set_item_w(command)
- refresh
- for i in 1...$data_armors.size
- if $game_party.get_warehouse(i,"A") > 0 and $data_armors[i].desc == command
- @data.push($data_armors[i])
- end
- end
- for i in 1...$data_items.size
- if $game_party.get_warehouse(i,"I") > 0 and $data_items[i].desc == command
- @data.push($data_items[i])
- end
- end
- for i in 1...$data_weapons.size
- if $game_party.get_warehouse(i,"W") > 0 and $data_weapons[i].desc == command
- @data.push($data_weapons[i])
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i,true)
- end
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def item_number
- return @item_max
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_item(index,w = false)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if w == true
- case item
- when RPG::Item
- number = $game_party.get_warehouse(item.id,"I")
- when RPG::Weapon
- number = $game_party.get_warehouse(item.id,"W")
- when RPG::Armor
- number = $game_party.get_warehouse(item.id,"A")
- end
- end
- x = 4
- y = index * 32
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
- self.contents.font.color = text_color(item.name_color_66RPG)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Window_Warehouse_Number
- #------------------------------------------------------------------------------
- # 仓库输入存取数量的窗口。
- #==============================================================================
- class Window_Warehouse_Number < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(140, 208, 360, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- @item = nil
- @max = 1
- @number = 1
- end
- #--------------------------------------------------------------------------
- # ● 设置物品、最大个数、价格
- #--------------------------------------------------------------------------
- def set(item, max)
- @item = item
- @max = max
- @number = 1
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 被输入的件数设置
- #--------------------------------------------------------------------------
- def number
- return @number
- end
-
- def get_item
- return @item
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_item_name(@item, 0, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text( 263, 0, 32, 32, "×")
- self.contents.draw_text( 290, 0, 24, 32, @number.to_s, 2)
- self.cursor_rect.set( 287, 0, 32, 32)
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- if self.active
- # 光标右 (+1)
- if Input.repeat?(Input::RIGHT) and @number < @max
- $game_system.se_play($data_system.cursor_se)
- @number += 1
- refresh
- end
- # 光标左 (-1)
- if Input.repeat?(Input::LEFT) and @number > 1
- $game_system.se_play($data_system.cursor_se)
- @number -= 1
- refresh
- end
- # 光标上 (+10)
- if Input.repeat?(Input::UP) and @number < @max
- $game_system.se_play($data_system.cursor_se)
- @number = [@number + 10, @max].min
- refresh
- end
- # 光标下 (-10)
- if Input.repeat?(Input::DOWN) and @number > 1
- $game_system.se_play($data_system.cursor_se)
- @number = [@number - 10, 1].max
- refresh
- end
- end
- end
- end
- #==============================================================================
- # ■ 设置
- #==============================================================================
- #在这里设定分类项目,顺序按照编号排列
- $Sorting = ["普通物品",
- "药品类",
- "武器类",
- "护甲类",
- "首饰类",
- "食材",
- "料理",
- "任务物品"]
- #==============================================================================
- # ■ RPG追加定义,使用@符号分类
- #==============================================================================
- module RPG
- class Weapon
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def desc
- desc = @description.split(/@/)[1]
- return desc != nil ? desc : "武器"
- end
- end
- class Item
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def desc
- desc = @description.split(/@/)[1]
- return desc != nil ? desc : "物品"
- end
- end
- class Armor
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def desc
- desc = @description.split(/@/)[1]
- return desc != nil ? desc : "防具"
- end
- end
- end
- # ————————————————————————————————————
- # 本脚本来自www.66rpg.com,转载请保留此信息
- # ————————————————————————————————————
- #==============================================================================
- # ■ Scene_Warehouse
- #------------------------------------------------------------------------------
- # 处理仓库画面的类。
- #==============================================================================
- class Scene_Warehouse
- def main
- # 生成帮助窗口
- @help_window = Window_Help.new
- # 生成动作窗口
- @action_window = Window_Warehouse_Action.new
- # 生成仓库标题
- @title_window = Window_Warehouse_Title.new
- # 生成分类窗口
- @sorting_window = Window_Warehouse_Sorting.new
- @sorting_window.index = -1
- @sorting_window.active = false
- # 生成物品窗口
- @item_window = Window_Warehouse_Item.new
- @item_window.active = false
- @item_window.help_window = @help_window
- # 生成数量输入窗口
- @number_window = Window_Warehouse_Number.new
- @number_window.active = false
- @number_window.visible = false
- # 初始化项目
- @item_index = -1
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @help_window.dispose
- @action_window.dispose
- @title_window.dispose
- @sorting_window.dispose
- @item_window.dispose
- @number_window.dispose
- end
-
- #--------------------------------------------------------------------------
- # 更新画面
- #--------------------------------------------------------------------------
- def update
- # 更新窗口内容
- @help_window.update
- @action_window.update
- @title_window.update
- # 更新动作窗口
- if @action_window.active
- update_action_window
- return
- end
- # 更新分类窗口
- if @sorting_window.active
- update_sorting_window
- end
- # 更新物品窗口
- if @item_window.active
- update_item_window
- return
- end
- # 更新数量输入窗口
- if @number_window.active
- update_number_window
- end
-
- end
- #--------------------------------------------------------------------------
- # 更新动作窗口
- #--------------------------------------------------------------------------
- def update_action_window
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口光标位置分支
- case @action_window.index
- when 0 # 存入
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- @action_window.active = false
- @sorting_window.active = true
- @sorting_window.index = 0
- when 1 # 取出
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- @action_window.active = false
- @sorting_window.active = true
- @sorting_window.index = 0
- @sorting_window.refresh(1)
- when 2 # 取消
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到地图画面
- $scene = Scene_Map.new
- end
- return
- end
- @sorting_window.refresh(@action_window.index)
- end
- #--------------------------------------------------------------------------
- # 更新分类窗口
- #--------------------------------------------------------------------------
- def update_sorting_window
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到地图画面
- @sorting_window.index = -1
- @sorting_window.update
- @action_window.active = true
- @sorting_window.active = false
- @item_window.set_item("")
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- if @action_window.index == 0
- if @sorting_window.have_item(@sorting_window.index) != @sorting_window.disabled_color
- $game_system.se_play($data_system.decision_se)
- @sorting_window.active = false
- @item_window.active = true
- @item_window.index = 0
- else
- $game_system.se_play($data_system.buzzer_se)
- end
- else
- if @sorting_window.have_item_w(@sorting_window.index) != @sorting_window.disabled_color
- $game_system.se_play($data_system.decision_se)
- @sorting_window.active = false
- @item_window.active = true
- @item_window.index = 0
- else
- $game_system.se_play($data_system.buzzer_se)
- end
- end
- end
-
- # 更新物品窗口
- if @action_window.index == 0
- @item_window.set_item(@sorting_window.commands[@sorting_window.index])
- elsif @action_window.index ==1
- @item_window.set_item_w(@sorting_window.commands[@sorting_window.index])
- end
- @sorting_window.update
- end
-
- #--------------------------------------------------------------------------
- # 更新物品窗口
- #--------------------------------------------------------------------------
- def update_item_window
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- @sorting_window.active = true
- @item_window.active = false
- @item_window.index = -1
- @help_window.set_text("")
- return
- end
- # 按下确定键
- if Input.trigger?(Input::C)
- # 获取物品数量
- $game_system.se_play($data_system.decision_se)
- if @item_window.item.is_a?(RPG::Item)
- if @action_window.index == 0
- i = $game_party.item_number(@item_window.item.id)
- else
- i = $game_party.get_warehouse(@item_window.item.id,"I")
- end
- elsif @item_window.item.is_a?(RPG::Weapon)
- if @action_window.index == 0
- i = $game_party.weapon_number(@item_window.item.id)
- else
- i = $game_party.get_warehouse(@item_window.item.id,"W")
- end
- else
- if @action_window.index == 0
- i = $game_party.armor_number(@item_window.item.id)
- else
- i = $game_party.get_warehouse(@item_window.item.id,"A")
- end
- end
- @number_window.set(@item_window.item, i)
- @number_window.active = true
- @number_window.visible = true
- @item_window.active = false
- end
- @item_window.update
- if @action_window.index == 0
- @item_window.set_item(@sorting_window.commands[@sorting_window.index])
- elsif @action_window.index ==1
- @item_window.set_item_w(@sorting_window.commands[@sorting_window.index])
- end
-
- end
- #--------------------------------------------------------------------------
- # 更新输入窗口
- #--------------------------------------------------------------------------
- def update_number_window
- @number_window.update
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- @number_window.active = false
- @number_window.visible = false
- @item_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- @number_window.active = false
- @number_window.visible = false
- @item_window.active = true
- #处理存储操作
- if @action_window.index == 0
- if @number_window.get_item.is_a?(RPG::Item)
- $game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"I")
- $game_party.lose_item(@number_window.get_item.id, @number_window.number)
- elsif @number_window.get_item.is_a?(RPG::Weapon)
- $game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"W")
- $game_party.lose_weapon(@number_window.get_item.id, @number_window.number)
- else
- $game_party.add_warehouse(@number_window.get_item.id,@number_window.number,"A")
- $game_party.lose_armor(@number_window.get_item.id, @number_window.number)
- end
- #判读储存后状态
- if @sorting_window.have_item(@sorting_window.index) == @sorting_window.disabled_color
- @item_window.index = -1
- @item_window.active = false
- @sorting_window.active = true
- @sorting_window.refresh
- @help_window.set_text("")
- end
- elsif @action_window.index == 1
- if @number_window.get_item.is_a?(RPG::Item)
- $game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"I")
- $game_party.gain_item(@number_window.get_item.id, @number_window.number)
- elsif @number_window.get_item.is_a?(RPG::Weapon)
- $game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"W")
- $game_party.gain_weapon(@number_window.get_item.id, @number_window.number)
- else
- $game_party.del_warehouse(@number_window.get_item.id,@number_window.number,"A")
- $game_party.gain_armor(@number_window.get_item.id, @number_window.number)
- end
- #判读储存后状态
- if @sorting_window.have_item_w(@sorting_window.index) == @sorting_window.disabled_color
- @item_window.index = -1
- @item_window.active = false
- @sorting_window.active = true
- @sorting_window.refresh(1)
- @help_window.set_text("")
- end
- end
- end
- end
-
- end
- #==============================================================================
- # ■ Game_System
- #------------------------------------------------------------------------------
- # 追加仓库物品
- #==============================================================================
- class Game_Party
- attr_accessor :Warehouse
- alias o_initialize initialize
- def initialize
- o_initialize
- @Warehouse_Item = []
- @Warehouse_Weapon = []
- @Warehouse_Armor = []
- for i in 1...$data_armors.size
- @Warehouse_Armor.push($data_armors[i])
- @Warehouse_Armor[i] = 0
- end
-
- for i in 1...$data_items.size
- @Warehouse_Item.push($data_items[i])
- @Warehouse_Item[i] = 0
- end
-
- for i in 1...$data_weapons.size
- @Warehouse_Weapon.push($data_weapons[i])
- @Warehouse_Weapon[i] = 0
- end
-
- end
-
- def add_warehouse(item,num,type)
- if type == "I"
- @Warehouse_Item[item] += num
- elsif type == "W"
- @Warehouse_Weapon[item] += num
- elsif type == "A"
- @Warehouse_Armor[item] += num
- end
- end
-
- def get_warehouse(item,type)
- if type == "I"
- return @Warehouse_Item[item]
- elsif type == "W"
- return @Warehouse_Weapon[item]
- elsif type == "A"
- return @Warehouse_Armor[item]
- end
- return @Warehouse[item]
- end
-
- def del_warehouse(item,num,type)
- if type == "I"
- @Warehouse_Item[item] -= num
- elsif type == "W"
- @Warehouse_Weapon[item] -= num
- elsif type == "A"
- @Warehouse_Armor[item] -= num
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #
- # 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
- # 可以更改的种类包括物品、防具、特技、武器。
- #
- # 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
- # 数字为颜色编号,和对话框中的一样。
- # ——————————————————————————————————————
- module RPG
- class Skill
- def description
- description = @description.split(/:/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/:/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Weapon
- def description
- description = @description.split(/:/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/:/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Item
- def description
- description = @description.split(/:/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/:/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Armor
- def description
- description = @description.split(/:/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/:/)[1]
- return name != nil ? name_color.to_i : 0
- end
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 描绘物品名
- # item : 物品
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y)
- if item == nil
- return
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32))
- self.contents.font.color = text_color(item.name_color_66RPG)
- self.contents.draw_text(x + 28, y, 212, 32, item.name.to_s)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Item
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- # if item.is_a?(RPG::Item) and
- # $game_party.item_can_use?(item.id)
- # self.contents.font.color = text_color(item.name_color_66RPG)
- # else
- # self.contents.font.color = disabled_color
- #end
- self.contents.font.color = text_color(item.name_color_66RPG)
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- 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)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, "×", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_EquipItem < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 项目的描绘
- # index : 项目符号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- case item
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32))
- self.contents.font.color = text_color(item.name_color_66RPG)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_ShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 描绘羡慕
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- # 获取物品所持数
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- # 价格在所持金以下、并且所持数不是 99 的情况下为普通颜色
- # 除此之外的情况设置为无效文字色
- # if item.price <= $game_party.gold and number < 99
- # self.contents.font.color = text_color(item.name_color_66RPG)
- # else
- # self.contents.font.color = disabled_color
- #end
- self.contents.font.color = text_color(item.name_color_66RPG)
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_ShopSell < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目标号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- # 可以卖掉的显示为普通颜色、除此之外设置成无效文字颜色
- # if item.price > 0
- # self.contents.font.color = text_color(item.name_color_66RPG)
- # else
- # self.contents.font.color = disabled_color
- #end
- self.contents.font.color = text_color(item.name_color_66RPG)
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- 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)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, "×", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
-
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Skill
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = text_color(skill.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- 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(skill.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- end
- #==============================================================================
- # ■ Harts_Window_ItemTitle
- #==============================================================================
- class Harts_Window_ItemTitle < Window_Base
- #--------------------------------------------------------------------------
- # ● 描绘羡慕
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- # 获取物品所持数
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- # 价格在所持金以下、并且所持数不是 99 的情况下为普通颜色
- # 除此之外的情况设置为无效文字色
- # if item.price <= $game_party.gold and number < 99
- # self.contents.font.color = text_color(item.name_color_66RPG)
- # else
- # self.contents.font.color = disabled_color
- #end
- self.contents.font.color = text_color(item.name_color_66RPG)
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == text_color(item.name_color_66RPG) ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 使用方法:复制脚本搽到脚本编辑器MAIN前
脚本功能:分类仓库、物品品质、物品背包分类
我把收集的脚本做了点修改,所以达到如此效果:
|
评分
-
参与人数 2 | 星屑 +1200 |
梦石 +6 |
赞 +10 |
收起
理由
|
论坛助理
| |
|
+ 6 |
参赛奖励 |
小传子
| + 1200 |
+ 6 |
+ 4 |
不修改排版之前不会有第二波奖励. |
查看全部评分
|