Project1
标题:
【求助】怎样让包裹里的东西也能看出品质
[打印本页]
作者:
chd114
时间:
2012-6-10 14:53
标题:
【求助】怎样让包裹里的东西也能看出品质
#==============================================================================
# 本脚本来自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 = normal_color
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 = normal_color
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 = 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,使用和转载请保留此信息
#==============================================================================
#
# 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
# 可以更改的种类包括物品、防具、特技、武器。
#
# 使用方法:对于不想为白色表示的物品,在描述中最后添加@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 % 4 * (288 + 32) *3/4
y = index / 4 * 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 + 135, y, 16, 32, "×", 1)
self.contents.draw_text(x + 144, 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,使用和转载请保留此信息
#==============================================================================
复制代码
物品品质的脚本,球正确的修改方法使其可以在包裹中也显示颜色而且不能用的显示无效颜色 dsu_plus_rewardpost_czw
作者:
kangxi0109
时间:
2012-6-10 21:33
验收吧,几个问题的东西都在里面了...强烈要求加分!
Data.zip
(309.89 KB, 下载次数: 60)
2012-6-10 21:33 上传
点击文件名下载附件
作者:
chd114
时间:
2012-6-11 12:29
kangxi0109 发表于 2012-6-10 21:33
验收吧,几个问题的东西都在里面了...强烈要求加分!
为什么下下来只有DATA文件夹?好压提示文件损坏
‘‘──chd114于2012-6-11 13:08补充以下内容:
对不起阿刚刚在吃饭···再发一次吧
’’
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1