赞 | 7 |
VIP | 866 |
好人卡 | 185 |
积分 | 32 |
经验 | 130059 |
最后登录 | 2024-10-29 |
在线时间 | 3618 小时 |
Lv3.寻梦者 双子人
- 梦石
- 0
- 星屑
- 3185
- 在线时间
- 3618 小时
- 注册时间
- 2009-4-4
- 帖子
- 4154
|
本帖最后由 hys111111 于 2012-7-17 12:42 编辑
- #==================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==================================================================
- #一行20个中文字,最多4行,使用"|"符号进行换行。
- #数据库说明不限制行数,同样使用"|"符号进行换行。
- $data2 = [] #存包包物品
- HeroText=[] #角色说明
- HeroText[1] = "出身平民之家,自幼习得一身好武艺。以一柄|长剑或单刀行走于江湖,是个锄强扶弱,行侠|仗义的少年英雄。"
- Armor_element_name =["头盔","铠甲","护盾","项链","戒指","鞋子","腰带","手镯","勋章"] #防具属性名称
- Armor_element_name_id = [2,3,1,5,4,6,7,8,9] #装备物品是的索引,作用见equip函数
- class HeroItemBag
- attr_reader :viewport1
- attr_reader :viewport2
- #--------------------------------------------------------------------------
- # ● 初期化
- #--------------------------------------------------------------------------
- #def initialize(viewport=nil)
- #super(viewport)
- #end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- #背景界面
- @viewport1 = Viewport.new(0, 0, 640, 480)
- @HeroItemBag = Sprite.new(@viewport1)
- @viewport1.z = 1000
- @bitmap = Bitmap.new('Graphics/Windowskins/HeroItemBag.PNG')
- @HeroItemBag.bitmap = @bitmap
- @HeroItemBag.visible = true
- @HeroItemBag.x = (640 - @bitmap.width)/2
- @HeroItemBag.y = 0
- @HeroItemBag.z = 1000
- #文字界面
- @viewport2 = Viewport.new(0, 0, 640, 480)
- @HeroItemBag2 = Sprite.new(@viewport2)
- @viewport2.z = 1100
- @bitmap2 = Bitmap.new(@bitmap.width,@bitmap.height)
- @HeroItemBag2.bitmap = @bitmap2
- @HeroItemBag2.visible = true
- @HeroItemBag2.x = (640 - @bitmap.width)/2
- @HeroItemBag2.y = 0
- @HeroItemBag2.z = 1100
- #人物精灵
- @bitmap3=[]
- @HeroItemBag3 =[]
- for i in 0..4 #主身#衣服#头盔#武器#盾
- @HeroItemBag3[i] = Sprite.new(nil)
- @HeroItemBag3[i].visible = true
- @HeroItemBag3[i].x = @HeroItemBag.x + 19
- @HeroItemBag3[i].y = @HeroItemBag.y + 21
- @HeroItemBag3[i].z = 1200 + i * 100
- end
- #物品说明窗口背景
- $HeroItemBag4 = Sprite.new(nil)
- @bitmap4 = Bitmap.new('Graphics/Windowskins/Item.PNG')
- $HeroItemBag4.bitmap = @bitmap4
- $HeroItemBag4.visible = false
- $HeroItemBag4.zoom_x = 150.0 / @bitmap4.width
- $HeroItemBag4.zoom_y = 200.0 / @bitmap4.height
- $HeroItemBag4.x = 0
- $HeroItemBag4.y = 0
- $HeroItemBag4.z = 1700
- #$HeroItemBag4.opacity = 80
- #物品说明窗口
- $HeroItemBag5 = Sprite.new(nil)
- $bitmap5 = Bitmap.new(150,200)
- $HeroItemBag5.bitmap = $bitmap5
- $HeroItemBag5.visible = false
- $HeroItemBag5.z = 2000
-
- #更新属性界面
- heroupdate(false)
- #物品窗口
- $ItemIcon = Window_ItemIcon.new
- #地图界面
- @spriteset = Spriteset_Map.new
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- Kboard.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- self.dispose
- end
-
- def element_search(element_name)
- return nil if element_name == nil
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /^#{element_name}/
- return i
- end
- end
- end
-
- def update_item
- # 按下鼠标右键情况下
- if Kboard.keyboard($Rmouse_BUTTON_R)
- # 获取物品窗口当前选中的物品数据
- @item = $ItemIcon.item
- index = $ItemIcon.getindex
- case @item
- when RPG::Item
-
- # 不能使用的情况下
- unless $game_party.item_can_use?(@item.id)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if @item.scope >= 3
- # 设置效果范围 (单体/全体) 的对应光标位置
- if @item.scope == 4 || @item.scope == 6
- target_index = -1
- else
- target_index = 0
- end
- if target_index >= 0
- # 对目标角色应用物品的使用效果
- target = $game_party.actors[target_index]
- used = target.item_effect(@item)
- else
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- end
- # 使用物品的情况下
- if used
- # 演奏物品使用时的 SE
- $game_system.se_play(@item.menu_se)
- heroupdate(true)
- # 消耗品的情况下
- if @item.consumable
- # 使用的物品数减 1
- $game_party.lose_item(@item.id, 1)
- # 再描绘物品窗口的项目
- $ItemIcon.refresh
- end
- # 公共事件 ID 有效的情况下
- if @item.common_event_id > 0
- # 预约调用公共事件
- $game_temp.common_event_id = @item.common_event_id
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- end
- # 无法使用物品的情况下
- unless used
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- end
-
- when RPG::Weapon
- if index<10
- @actor.equip(0, 0)#@item == nil ? 0 : @item.id) #卸下武器
- else
- @actor.equip(0, @item == nil ? 0 : @item.id) #变更武器
- end
- $ItemIcon.refresh #刷新物品栏
- heroupdate(true) #强制刷新人物属性界面
-
- when RPG::Armor
- for i in 0..Armor_element_name.size
- id = element_search(Armor_element_name[i])
- if @item.guard_element_set.include?(id)
- break
- end
- end
- if index<10
- #if Armor_element_name_id[i]!=-1
- @actor.equip(Armor_element_name_id[i], 0) #卸下防具
- #end
- else
- #if Armor_element_name_id[i]!=-1
- @actor.equip(Armor_element_name_id[i], @item == nil ? 0 : @item.id) #装备防具
- #end
- end
- $ItemIcon.refresh
- heroupdate(true)
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新属性界面
- #--------------------------------------------------------------------------
- def heroupdate(reset = false)
- if $game_party.actors[0]!=@actor or reset
- @actor = $game_party.actors[0]
- @bitmap2.clear
- @bitmap2.font.size = 12
- #@bitmap2.font.bold = true
- @bitmap2.font.color = Color.new(0,0,0,0)
- name = @actor.name
- @bitmap2.draw_text(133, 19, name.size * 4, 24, name)#名字
- name = $data_classes[@actor.class_id].name
- @bitmap2.draw_text(133, 19 + 22, name.size * 4, 24, name)#职业
- #@bitmap2.font.bold = false
- @bitmap2.font.size = 14
- name = @actor.level.to_s
- @bitmap2.draw_text(133, 19 + 42, name.size * 4, 24, name)#等级
- name = @actor.exp_s + "/"+ @actor.next_rest_exp_s
- @bitmap2.draw_text(133, 19 + 63, name.size * 4, 24, name)#经验
- name = @actor.hp.to_s + "/" + @actor.maxhp.to_s
- @bitmap2.draw_text(87, 120, name.size * 4, 24, name)#hp
- name = @actor.sp.to_s + "/" + @actor.maxsp.to_s
- @bitmap2.draw_text(217, 120, name.size * 4, 24, name)#mp
- name = @actor.str.to_s
- @bitmap2.draw_text(87, 120+27, name.size * 4, 24, name)#力量
- name = @actor.dex.to_s
- @bitmap2.draw_text(217, 120+27, name.size * 4, 24, name)#灵巧
- name = @actor.agi.to_s
- @bitmap2.draw_text(87, 120+54, name.size * 4, 24, name)#速度
- name = @actor.int.to_s
- @bitmap2.draw_text(217, 120+54, name.size * 4, 24, name)#精神
- name = @actor.atk.to_s
- @bitmap2.draw_text(91, 208, name.size * 4, 24, name)#攻击
- name = @actor.pdef.to_s
- @bitmap2.draw_text(223, 208, name.size * 4, 24, name)#防御
- name = ""
- @bitmap2.draw_text(91, 208+27, name.size * 4, 24, name)#魔法攻击
- name = @actor.mdef.to_s
- @bitmap2.draw_text(223, 208+27, name.size * 4, 24, name)#魔法防御
- #@bitmap2.font.bold = true
- @bitmap2.font.size = 12
- name = HeroText[@actor.class_id]
- a = name.gsub(/^|/, '').split("|")
- row = a.size
- if row>4
- row = 4
- end
- for i in 1..a.size
- @bitmap2.draw_text(24, 252 + (i-1) * 60/row , 255, 60, a[i-1])#人物说明
- if i >= 4
- break
- end
- end
- #@bitmap2.font.bold = false
- @bitmap2.font.size = 14
- name = $game_party.gold.to_s
- @bitmap2.font.color = Color.new(255,255,0,255)
- @bitmap2.draw_text(340, 320, name.size * 4, 24, name)#金钱
-
- part_name = [
- @actor.character_name,
- @actor.armor3_id != 0 ? $data_armors[@actor.armor3_id].part : "",
- @actor.armor2_id != 0 ? $data_armors[@actor.armor2_id].part : "",
- @actor.weapon_id != 0 ? $data_weapons[@actor.weapon_id].part : "",
- @actor.armor1_id != 0 ? $data_armors[@actor.armor1_id].part : ""
- ]
- for i in [email protected]
- if @bitmap3[i]!=nil
- @bitmap3[i].dispose
- end
- pic = part_name[i] #@actor.character_name
- if pic!=nil and pic!=""
- bitmap = RPG::Cache.character(pic, @actor.character_hue)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- @HeroItemBag3[i].bitmap = bitmap
- @HeroItemBag3[i].zoom_x = 0.0 / cw
- @HeroItemBag3[i].zoom_y = 0.0 / ch
- # 设置传送目标的矩形
- sx = 0
- sy = 0
- @HeroItemBag3[i].src_rect.set(sx, sy, cw, ch)
- @bitmap3[i] = bitmap
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新属性界面
- heroupdate(false)
- # 刷新物品窗口
- $ItemIcon.update
- # 刷新按键
- update_item
- # 刷新地图精灵
- @spriteset.update
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- def dispose
- @HeroItemBag.dispose
- @HeroItemBag2.dispose
- for i in [email protected]
- @HeroItemBag3[i].dispose
- end
- for i in [email protected]
- if @bitmap3[i]!=nil
- @bitmap3[i].dispose
- end
- end
- $HeroItemBag4.dispose
- @bitmap.dispose
- @bitmap2.dispose
- @bitmap4.dispose
- $bitmap5.dispose
- @viewport1.dispose
- @viewport2.dispose
- $ItemIcon.dispose
- @spriteset.dispose
- end
- end
- #==============================================================================
- # ■ Window_Selectable
- #------------------------------------------------------------------------------
- # 拥有光标的移动以及滚动功能的窗口类。
- #==============================================================================
- class Window_Selectable3 < Window_Base
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :index # 光标位置
- attr_reader :help_window # 帮助窗口
- #--------------------------------------------------------------------------
- # ● 初始画对像
- # x : 窗口的 X 坐标
- # y : 窗口的 Y 坐标
- # width : 窗口的宽
- # height : 窗口的高
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @item_max = 1
- @column_max = 1
- @index = -1
- end
- #--------------------------------------------------------------------------
- # ● 设置光标的位置
- # index : 新的光标位置
- #--------------------------------------------------------------------------
- def index=(index)
- @index = index
- # 刷新光标矩形
- update_cursor_rect
- end
- #取得当前光标位置索引
- def Getindex
- return @index
- end
- #--------------------------------------------------------------------------
- # ● 获取行数
- #--------------------------------------------------------------------------
- def row_max
- # 由项目数和列数计算出行数
- return (@item_max + @column_max - 1) / @column_max
- end
- #--------------------------------------------------------------------------
- # ● 获取开头行
- #--------------------------------------------------------------------------
- def top_row
- # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
- return self.oy / 32
- end
- #--------------------------------------------------------------------------
- # ● 设置开头行
- # row : 显示开头的行
- #--------------------------------------------------------------------------
- def top_row=(row)
- # row 未满 0 的场合更正为 0
- if row < 0
- row = 0
- end
- # row 超过 row_max - 1 的情况下更正为 row_max - 1
- if row > row_max - 1
- row = row_max - 1
- end
- # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
- self.oy = row * 32
- end
- #--------------------------------------------------------------------------
- # ● 获取 1 页可以显示的行数
- #--------------------------------------------------------------------------
- def page_row_max
- # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
- return (self.height - 32) / 32
- end
- #--------------------------------------------------------------------------
- # ● 获取 1 页可以显示的项目数
- #--------------------------------------------------------------------------
- def page_item_max
- # 将行数 page_row_max 乘上列数 @column_max
- return page_row_max * @column_max
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- end
- end
- class Window_Selectable3
- if @self_alias == nil
- alias self_update update
- @self_alias = true
- end
-
- def update
- #self.cursor_rect.empty
- self_update
- if self.active and @item_max > 0
- index_var = @index
- tp_index = @index
- mouse_x, mouse_y = Mouse.get_mouse_pos
- mouse_not_in_rect = true
- for i in 0...@item_max
- @index = i
- update_cursor_rect
- top_x = self.cursor_rect.x + self.x + 16
- top_y = self.cursor_rect.y + self.y + 16
- bottom_x = top_x + self.cursor_rect.width
- bottom_y = top_y + self.cursor_rect.height
- if (mouse_x > top_x) and (mouse_y > top_y) and
- (mouse_x < bottom_x) and (mouse_y < bottom_y)
- mouse_not_in_rect = false
- if tp_index != @index
- tp_index = @index
- $game_system.se_play($data_system.cursor_se)
- end
- break
- end
- end
- if mouse_not_in_rect
- # row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT) and mouse_y>self.y+self.height/2
- self.top_row +=1
- end
- # 当前行被显示末尾行之后的情况下
- if self.top_row > 0 and Mouse.press?(Mouse::LEFT) and mouse_y<=self.y+self.height/2
- # 从当前行向末尾滚动
- self.top_row -=1
- end
- @index = index_var
- if self.is_a?(Window_Target)
- #@index=-3
- end
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
-
- def ItemTextUpdate2(index=0,i = 0)
- if index<2
- if item.pdef!=0
- i = i + 1
- name = $data_system.words.pdef
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.pdef>0
- name1 = "+ " + item.pdef.to_s
- else
- name1 = "- " + (-item.pdef).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
-
- if item.mdef!=0
- i = i + 1
- name = $data_system.words.mdef
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.mdef>0
- name1 = "+ " + item.mdef.to_s
- else
- name1 = "- " + (-item.mdef).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
-
- if item.str_plus!=0
- i = i + 1
- name = $data_system.words.str
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.str_plus>0
- name1 = "+ " + item.str_plus.to_s
- else
- name1 = "- " + (-item.str_plus).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
-
- if item.dex_plus!=0
- i = i + 1
- name = $data_system.words.dex
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.dex_plus>0
- name1 = "+ " + item.dex_plus.to_s
- else
- name1 = "- " + (-item.dex_plus).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
-
- if item.agi_plus!=0
- i = i + 1
- name = $data_system.words.agi
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.agi_plus>0
- name1 = "+ " + item.agi_plus.to_s
- else
- name1 = "- " + (-item.agi_plus).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
-
- if item.int_plus!=0
- i = i + 1
- name = $data_system.words.int
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.int_plus>0
- name1 = "+ " + item.int_plus.to_s
- else
- name1 = "- " + (-item.int_plus).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
- end
-
- case index
- when 0 #防具
- if item.eva!=0
- i = i + 1
- name = "闪避"
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.eva>0
- name1 = "+ " + item.eva.to_s
- else
- name1 = "- " + (-item.eva).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
- when 1 #武器
-
- when 2 #物品
- if item.parameter_type!=0
- i = i + 1
- case item.parameter_type
- when 1
- name = "Max" + $data_system.words.hp
- when 2
- name = "Max" + $data_system.words.sp
- when 3
- name = $data_system.words.str
- when 4
- name = $data_system.words.dex
- when 5
- name = $data_system.words.agi
- when 6
- name = $data_system.words.int
- end
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.parameter_points>0
- name1 = "+ " + item.parameter_points.to_s
- else
- name1 = "- " + (-item.parameter_points).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
- if item.recover_hp_rate!=0
- i = i + 1
- name = $data_system.words.hp + "回复率"
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.recover_hp_rate>0
- name1 = "+ " + item.recover_hp_rate.to_s + "%"
- else
- name1 = "- " + (-item.recover_hp_rate).to_s + "%"
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
- if item.recover_hp!=0
- i = i + 1
- name = $data_system.words.hp + "回复"
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.recover_hp>0
- name1 = "+ " + item.recover_hp.to_s
- else
- name1 = "- " + (-item.recover_hp).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
- if item.recover_sp_rate!=0
- i = i + 1
- name = $data_system.words.sp + "回复率"
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.recover_sp_rate>0
- name1 = "+ " + item.recover_sp_rate.to_s + "%"
- else
- name1 = "- " + (-item.recover_sp_rate).to_s + "%"
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
- if item.recover_sp!=0
- i = i + 1
- name = $data_system.words.sp + "回复"
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.recover_hp>0
- name1 = "+ " + item.recover_sp.to_s
- else
- name1 = "- " + (-item.recover_sp).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
- end
- return i
- end
-
- def ItemTextUpdate(item=nil)
- if item==@item
- return
- end
- @item = item
- if item == nil
- $HeroItemBag4.visible = false
- $HeroItemBag5.visible = false
- end
- if $bitmap5!=nil
- $bitmap5.dispose
- end
- $bitmap5 = Bitmap.new(150,200)
- $HeroItemBag5.bitmap = $bitmap5
- $bitmap5.font.size = 14
- #$bitmap5.font.bold = true
- $bitmap5.font.color = Color.new(255,255,255,255)
- name = item.name
- $bitmap5.draw_text(5, 3, name.size * 4, 24, name)#名字
- case item
- when RPG::Item
- #print(item.parameter_type)
- i = ItemTextUpdate2(2,0)
- i = i + 1
- name = item.description
- a = name.gsub(/^|/, '').split("|")
- for j in 1..a.size
- i = i + 1
- $bitmap5.draw_text(5, 3+16*i, a[j-1].size * 4, 24, a[j-1])
- end
- when RPG::Weapon
- i = 0
- if item.atk!=0
- i = i + 1
- name = $data_system.words.atk
- $bitmap5.draw_text(5, 3+16*i, name.size * 4, 24, name)
- if item.atk>0
- name1 = "+ " + item.atk.to_s
- else
- name1 = "- " + (-item.atk).to_s
- end
- $bitmap5.draw_text(5+name.size*4+10, 3+16*i, name1.size * 4, 24, name1)
- end
- i = ItemTextUpdate2(1,1)
- i = i + 1
- name = item.description
- a = name.gsub(/^|/, '').split("|")
- for j in 1..a.size
- i = i + 1
- $bitmap5.draw_text(5, 3+16*i, a[j-1].size * 4, 24, a[j-1])
- end
- when RPG::Armor
- i = ItemTextUpdate2(0,0)
- i = i + 1
- name = item.description
- a = name.gsub(/^|/, '').split("|")
- for j in 1..a.size
- i = i + 1
- $bitmap5.draw_text(5, 3+16*i, a[j-1].size * 4, 24, a[j-1])
- end
- end
- end
-
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 计算光标坐标
- if @index<5
- x = @index*32-2
- y = 2
- elsif @index<10
- x = (@index-5)*32-2
- y = 34
- else
- x = ((@index-10)%8)*32
- y = 106 + ((@index-10)/8)*32
- #print(y.to_s)
- #print(@index)
- end
- # 更新国标矩形
- # print(@index)
- self.cursor_rect.set(x, y, 32, 32)
- mouse_x, mouse_y = Mouse.get_mouse_pos
- if mouse_x+150<640
- $HeroItemBag4.x = mouse_x +16
- $HeroItemBag5.x = mouse_x +16
- else
- $HeroItemBag4.x = mouse_x-150+16
- $HeroItemBag5.x = mouse_x-150+16
- end
- if mouse_y + 200<480
- $HeroItemBag4.y = mouse_y +16
- $HeroItemBag5.y = mouse_y +16
- else
- $HeroItemBag4.y = mouse_y-200+16
- $HeroItemBag5.y = mouse_y-200+16
- end
- if $data2.size>0
- top_x = self.cursor_rect.x + self.x + 16
- top_y = self.cursor_rect.y + self.y + 16
- bottom_x = top_x + self.cursor_rect.width
- bottom_y = top_y + self.cursor_rect.height
- if $data2[@index]!=nil and (mouse_x > top_x) and (mouse_y > top_y) and (mouse_x < bottom_x) and (mouse_y < bottom_y)
- ItemTextUpdate($data2[@index])
- $HeroItemBag4.visible = true
- $HeroItemBag5.visible = true
- else
- $HeroItemBag4.visible = false
- $HeroItemBag5.visible = false
- end
- end
- end
- end
- class Window_ItemIcon < Window_Selectable3
- def initialize
- super(322, 0, 8*32+32, 9*32+32+8)
- #self.contents = Bitmap.new(width-32, height-32)
- self.z = 1500
- self.opacity = 0
- refresh
- #@column_max = 5
- #@item_max = 10
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- #print(self.index)
- return $data2[self.index]
- end
-
- def get_item(index)
- return $data2[index]
- end
-
- def getindex
- return self.index
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if $game_party!=nil
- actor = $game_party.actors[0]
- else
- return
- end
- #self.contents.clear
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @column_max = 8
- $data2 = []
- $data2.push($data_armors[actor.armor2_id]) #头盔
- $data2.push($data_armors[actor.armor3_id]) #衣服
- $data2.push($data_armors[actor.armor1_id]) #盾
- $data2.push($data_armors[actor.armor5_id]) #项链
- $data2.push($data_armors[actor.armor4_id]) #戒指
- $data2.push($data_armors[actor.armor6_id]) #鞋子
- $data2.push($data_armors[actor.armor7_id]) #腰带
- $data2.push($data_armors[actor.armor8_id]) #手镯
- $data2.push($data_weapons[actor.weapon_id]) #武器
- $data2.push($data_armors[actor.armor9_id]) #勋章
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- #for j in 1..$game_party.item_number(i)
- $data2.push($data_items[i])
- #end
- end
- end
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- for j in 1..$game_party.weapon_number(i)
- $data2.push($data_weapons[i])
- end
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- for j in 1..$game_party.armor_number(i)
- $data2.push($data_armors[i])
- end
- end
- end
- k = 58
- $data2.size>0 if k = 57
- for i in $data2.size..k
- $data2.push(nil)
- end
- @item_max = $data2.size
- self.contents = Bitmap.new(width - 32, height-32)
- self.contents.font.size = 12
- self.contents.font.bold = true
- #更新装备格图标
- for i in 0..9
- item = $data2[i]
- if item!=nil
- bitmap = RPG::Cache.icon(item.icon_name)
- width = bitmap.width
- height = bitmap.height
- if i<5
- self.contents.blt(-5+i*32,0, bitmap, Rect.new(0, 0,width,height), 255)
- else
- self.contents.blt(-8+(i-5)*32,-3+32, bitmap, Rect.new(0, 0,width,height), 255)
- end
- #case item
- #when RPG::Item
- #number = $game_party.item_number(item.id)
- #if i<5
- #self.contents.draw_text(15+i*32, 14, width, height, number.to_s)
- #else
- #self.contents.draw_text(15+(i-5)*32, 14+32, width, height, number.to_s)
- #end
- #when RPG::Weapon
- #number = $game_party.weapon_number(item.id)
- #when RPG::Armor
- #number = $game_party.armor_number(item.id)
- #end
- end
- end
- #更新物品栏图标
- for j in 1..6
- for i in 1..8
- item = $data2[9+i+(j-1)*8]
- if item!=nil
- bitmap = RPG::Cache.icon(item.icon_name)
- width = bitmap.width
- height = bitmap.height
- self.contents.blt(-5+(i-1)*32,0+105+(j-1)*32, bitmap, Rect.new(0, 0,width,height), 255)
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- self.contents.draw_text(5+(i-1)*32+13,6+105+(j-1)*32+8, width, height, number.to_s)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- end
- end
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #---------------------------------------------------------------------------------
- #需要能力值才能装备 改编自到达一定等级才能装备的武器和防具 By凌冰
- #用法:在武器、防具的说明里添加LV等级(后面的等级写个数字)STR力量(后面的力量写个数字)
- #DEX灵巧(后面的灵巧写个数字)AGI速度(后面的速度写个数字)INT魔力(后面的魔力写个数字)
- #可以空缺,空缺项默认为1
- #建议和升级加点脚本配合使用
- #---------------------------------------------------------------------------------
- module RPG
- class Weapon
- def level
- return 1 if @description.split(/LV/)[1] == nil
- return @description.split(/LV/)[1]
- end
- def str
- return 1 if @description.split(/STR/)[1] == nil
- return @description.split(/STR/)[1]
- end
- def dex
- return 1 if @description.split(/DEX/)[1] == nil
- return @description.split(/DEX/)[1]
- end
- def agi
- return 1 if @description.split(/AGI/)[1] == nil
- return @description.split(/AGI/)[1]
- end
- def int
- return 1 if @description.split(/INT/)[1] == nil
- return @description.split(/INT/)[1]
- end
- # def description
- # return @description.split(/LV/)[0] + "{装备等级" + level + "}"
- # end
- end
- class Armor
- def level
- return 1 if @description.split(/LV/)[1] == nil
- return @description.split(/LV/)[1]
- end
- def str
- return 1 if @description.split(/STR/)[1] == nil
- return @description.split(/STR/)[1]
- end
- def dex
- return 1 if @description.split(/DEX/)[1] == nil
- return @description.split(/DEX/)[1]
- end
- def agi
- return 1 if @description.split(/AGI/)[1] == nil
- return @description.split(/AGI/)[1]
- end
- def int
- return 1 if @description.split(/INT/)[1] == nil
- return @description.split(/INT/)[1]
- end
- # def description
- # return @description.split(/LV/)[0] + "{装备等级" + level + "}"
- # end
- end
- end
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 可以装备判定
- # item : 物品
- #--------------------------------------------------------------------------
- def equipable?(item)
- # 武器的情况
- if item.is_a?(RPG::Weapon)
- # 包含当前的职业可以装备武器的场合
- if $data_classes[@class_id].weapon_set.include?(item.id) and item.level.to_i<=@level
- if item.str.to_i<= str and item.dex.to_i<= dex and item.agi.to_i<= agi and item.int.to_i<= int
- return true
- end
- end
- end
- # 防具的情况
- if item.is_a?(RPG::Armor)
- # 不包含当前的职业可以装备武器的场合
- if $data_classes[@class_id].armor_set.include?(item.id) and item.level.to_i<=@level
- if item.str.to_i<= str and item.dex.to_i<= dex and item.agi.to_i<= agi and item.int.to_i<= int
- return true
- end
- end
- end
- return false
- end
- end
- #==============================================================================
- # ■ Window_EquipItem
- #------------------------------------------------------------------------------
- # 装备画面、显示浏览变更装备的候补物品的窗口。
- #==============================================================================
- class Window_ItemIcon < Window_Selectable3
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- # 添加可以装备的武器
- if @equip_type == 0
- weapon_set = $data_classes[@actor.class_id].weapon_set
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and @actor.equipable?($data_weapons[i])
- @data.push($data_weapons[i])
- end
- end
- end
- # 添加可以装备的防具
- if @equip_type != 0
- armor_set = $data_classes[@actor.class_id].armor_set
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0 and armor_set.include?(i) and @actor.equipable?($data_armors[i])
- if $data_armors[i].kind == @equip_type-1
- @data.push($data_armors[i])
- end
- end
- end
- end
- # 添加空白
- @data.push(nil)
- # 生成位图、描绘全部项目
- @item_max = @data.size
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max-1
- draw_item(i)
- end
- end
- end
- module RPG
- class Weapon
- def description
- a = @description
- a = a.split(/LV/)[0] if a.split(/LV/)[1] != nil
- a = a.split(/STR/)[0] if a.split(/STR/)[1] != nil
- a = a.split(/DEX/)[0] if a.split(/DEX/)[1] != nil
- a = a.split(/AGI/)[0] if a.split(/AGI/)[1] != nil
- a = a.split(/INT/)[0] if a.split(/INT/)[1] != nil
- return a
- end
- end
- class Armor
- def description
- a = @description
- a = a.split(/LV/)[0] if a.split(/LV/)[1] != nil
- a = a.split(/STR/)[0] if a.split(/STR/)[1] != nil
- a = a.split(/DEX/)[0] if a.split(/DEX/)[1] != nil
- a = a.split(/AGI/)[0] if a.split(/AGI/)[1] != nil
- a = a.split(/INT/)[0] if a.split(/INT/)[1] != nil
- return a
- end
- end
- end
复制代码 试试看吧。(第一次测试的时候没有效果,原来是Window给换掉了) |
评分
-
查看全部评分
|