#==============================================================================
# ★ RGSS3_実績メダル Ver1.01
#==============================================================================
=begin
作者:tomoaky
webサイト:ひきも記 ([url]http://hikimoki.sakura.ne.jp/[/url])
すごい記録を達成したときにポコンッと出るあれです。
イベントコマンド『スクリプト』を使ってメダルを獲得することができます。
例)gain_medal(0) # 0番のメダルを獲得する
設定項目にて番号に対応するメダルの内容を設定してください。
2012.01.25 Ver1.01
メダル獲得表示中のシーン切り替えにより表示がリセットされないように修正
2012.01.16 Ver1.0
公開
=end
#==============================================================================
# □ 設定項目
#==============================================================================
module TMMEDAL
COMMAND_MEDAL = "成就" # 菜单命令名字
# 一个荣誉也没有时隐藏菜单(true隐藏;false不隐藏)
HIDE_COMMAND = false
# 荣誉获得时的效果音
SE_GAIN_MEDAL = RPG::SE.new("Powerup", 90, 140)
# 荣誉名称及简介的设置
#例如:MEDAL_DATA[0] = ["名字", 187, "简介"]
# 证件名,图标ID,说明的设定 脚本设置:gain_medal(0)
MEDAL_DATA = {}
MEDAL_DATA[0] = ["初入江湖小虾米", 187, "苍月大陆人民还不了解你,继续努力吧!"]
MEDAL_DATA[1] = ["一代大侠真英豪", 187, "苍月大陆人民有盛传你的事迹,继续加油吧!"]
MEDAL_DATA[2] = ["千秋万代一统江湖", 187, "苍月大陆人民你的事迹已成为神话,继续保持吧"]
MEDAL_DATA[3] = ["鬼哭狼嚎", 187, "杀死100个狼"]
MEDAL_DATA[4] = ["一鸣惊人", 187, "杀死100个咕咕鸡"]
MEDAL_DATA[5] = ["天篷元帅", 187, "杀死100个魔化兵"]
MEDAL_DATA[6] = ["辣手摧花", 187, "杀死100个花妖"]
MEDAL_DATA[7] = ["灭魔小将军", 187, "杀死200个怪物"]
MEDAL_DATA[8] = ["虾米王", 187, "杀死300个怪物"]
MEDAL_DATA[9] = ["筑基", 187, "等级到达10级"]
MEDAL_DATA[10] = ["旋照", 187, "等级到达20级"]
MEDAL_DATA[11] = ["融合", 187, "等级到达30级"]
MEDAL_DATA[12] = ["心动", 187, "等级到达40级"]
MEDAL_DATA[13] = ["灵寂", 187, "等级到达50级"]
MEDAL_DATA[14] = ["元婴", 187, "等级到达60级"]
MEDAL_DATA[15] = ["出窍", 187, "等级到达70级"]
MEDAL_DATA[16] = ["分神", 187, "等级到达80级"]
MEDAL_DATA[17] = ["合体", 187, "等级到达90级"]
MEDAL_DATA[18] = ["度劫", 187, "等级到达100级"]
MEDAL_DATA[19] = ["大乘", 187, "等级到达110级"]
MEDAL_DATA[20] = ["狂魔", 187, "等级到达120级"]
MEDAL_DATA[21] = ["魔圣", 187, "等级到达130级"]
MEDAL_DATA[22] = ["魔尊", 187, "等级到达140级"]
MEDAL_DATA[23] = ["神人", 187, "等级到达150级"]
MEDAL_DATA[24] = ["天神", 187, "等级到达160级"]
MEDAL_DATA[25] = ["神王", 187, "等级到达170级"]
MEDAL_DATA[26] = ["天尊", 187, "等级到达180级"]
MEDAL_DATA[25] = ["神王", 187, "等级到达170级"]
MEDAL_DATA[26] = ["天尊", 187, "等级到达180级"]
MEDAL_DATA[27] = ["鸿蒙", 187, "等级到达190级"]
MEDAL_DATA[28] = ["真有", 187, "等级到达200级"]
MEDAL_DATA[29] = ["空间", 187, "等级到达210级"]
MEDAL_DATA[30] = ["虚无", 187, "等级到达220级"]
MEDAL_DATA[31] = ["时间", 187, "等级到达230级"]
MEDAL_DATA[32] = ["混元圣人", 187, "等级到达240级"]
MEDAL_DATA[33] = ["牛刀小试·初 ", 187, "杀死100个怪物"]
MEDAL_DATA[34] = ["牛刀小试·贰", 187, "杀死200个怪物"]
MEDAL_DATA[35] = ["牛刀小试·叁", 187, "杀死500个怪物"]
MEDAL_DATA[36] = ["牛刀小试·肆 ", 187, "杀死1000个怪物"]
MEDAL_DATA[37] = ["牛刀小试·伍 ", 187, "杀死2000个怪物"]
MEDAL_DATA[38] = ["血战沙场·初", 187, "杀死5000个怪物"]
MEDAL_DATA[39] = ["血战沙场·贰", 187, "杀死10000个怪物"]
MEDAL_DATA[40] = ["血战沙场·叁", 187, "杀死20000个怪物"]
MEDAL_DATA[41] = ["血战沙场·肆", 187, "杀死50000个怪物"]
MEDAL_DATA[42] = ["血战沙场·伍", 187, "杀死100000个怪物"]
MEDAL_DATA[43] = ["死亡的洗礼", 187, "经历一次死亡的洗礼,对成长是有好处的。"]
MEDAL_DATA[44] = ["千秋万代一统江湖", 187, "杀死1000个怪物"]
MEDAL_DATA[45] = ["初入江湖小虾米", 187, "杀死100个怪物"]
MEDAL_DATA[1] = ["一代大侠真英豪", 187, "杀死500个怪物"]
MEDAL_DATA[2] = ["千秋万代一统江湖", 187, "杀死1000个怪物"]
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● 公开实例变量
#--------------------------------------------------------------------------
attr_reader :medals # 已获得证件
attr_reader :new_medals # 新获得证件
attr_accessor :medal_info_count # 证件信息显示计数
attr_accessor :medal_info_opacity # 证件信息显示不透明度
#--------------------------------------------------------------------------
# ● 对象初期化
#--------------------------------------------------------------------------
alias tmmedal_game_party_initialize initialize
def initialize
tmmedal_game_party_initialize
@medals = []
@new_medals = []
@medal_info_count = 0
@medal_info_opacity = 0
end
#--------------------------------------------------------------------------
# ○ メダルの獲得
#--------------------------------------------------------------------------
def gain_medal(medal_id)
return if @medals.any? {|medal| medal[0] == medal_id }
t = Time.now.strftime(" (%Y/%m/%d %H:%M)")
@medals.push([medal_id, t])
@new_medals.push([medal_id, t])
end
#--------------------------------------------------------------------------
# ○ 获得证件信息消去
#--------------------------------------------------------------------------
def delete_new_medal
@new_medals.shift
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ○ メダルの獲得
#--------------------------------------------------------------------------
def gain_medal(medal_id)
$game_party.gain_medal(medal_id)
end
end
#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand
#--------------------------------------------------------------------------
# ● 独自指令的追加用
#--------------------------------------------------------------------------
alias tmmedal_window_menucommand_add_original_commands add_original_commands
def add_original_commands
tmmedal_window_menucommand_add_original_commands
unless TMMEDAL::HIDE_COMMAND && !medal_enabled
add_command(TMMEDAL::COMMAND_MEDAL, :medal, medal_enabled)
end
end
#--------------------------------------------------------------------------
# ○ メダルの有効状態を取得
#--------------------------------------------------------------------------
def medal_enabled
!$game_party.medals.empty?
end
end
#==============================================================================
# □ Window_MedalInfo
#==============================================================================
class Window_MedalInfo < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(Graphics.width - window_width, 0, window_width, fitting_height(1))
self.opacity = 0
self.contents_opacity = $game_party.medal_info_opacity
refresh
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 240
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if $game_party.medal_info_count > 0
self.contents_opacity += 16
$game_party.medal_info_count -= 1
$game_party.delete_new_medal if $game_party.medal_info_count == 0
else
self.contents_opacity -= 16
if self.contents_opacity == 0
open unless $game_party.new_medals.empty?
end
end
$game_party.medal_info_opacity = self.contents_opacity
end
#--------------------------------------------------------------------------
# ● ウィンドウを開く
#--------------------------------------------------------------------------
def open
refresh
TMMEDAL::SE_GAIN_MEDAL.play
$game_party.medal_info_count = 150
self.contents_opacity = 0
self
end
#--------------------------------------------------------------------------
# ○ リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
unless $game_party.new_medals.empty?
draw_background(contents.rect)
medal = TMMEDAL::MEDAL_DATA[$game_party.new_medals[0][0]]
rect = contents.rect.clone
draw_icon(medal[1], rect.x, rect.y)
rect.x += 24
rect.width -= 24
draw_text(rect, medal[0])
end
end
#--------------------------------------------------------------------------
# ○ 背景の描画
#--------------------------------------------------------------------------
def draw_background(rect)
temp_rect = rect.clone
temp_rect.width /= 2
contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
temp_rect.x = temp_rect.width
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
end
#--------------------------------------------------------------------------
# ○ 背景色 1 の取得
#--------------------------------------------------------------------------
def back_color1
Color.new(0, 0, 0, 192)
end
#--------------------------------------------------------------------------
# ○ 背景色 2 の取得
#--------------------------------------------------------------------------
def back_color2
Color.new(0, 0, 0, 0)
end
end
#==============================================================================
# □ Window_Medal
#==============================================================================
class Window_Medal < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
refresh
select(0)
activate
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# ● アイテムリストの作成
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.medals
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
medal = TMMEDAL::MEDAL_DATA[item[0]]
rect = item_rect(index)
draw_icon(medal[1], rect.x, rect.y)
rect.x += 24
rect.width -= 216
draw_text(rect, medal[0])
rect.x = contents.width - 192
rect.width = 192
draw_text(rect, item[1], 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
if item
medal = TMMEDAL::MEDAL_DATA[item[0]]
text = medal[2]
@help_window.set_text(text)
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● 全ウィンドウの作成
#--------------------------------------------------------------------------
alias tmmedal_scene_map_create_all_windows create_all_windows
def create_all_windows
tmmedal_scene_map_create_all_windows
create_medal_window
end
#--------------------------------------------------------------------------
# ○ メダルウィンドウの作成
#--------------------------------------------------------------------------
def create_medal_window
@medal_window = Window_MedalInfo.new
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
alias tmmedal_scene_menu_create_command_window create_command_window
def create_command_window
tmmedal_scene_menu_create_command_window
@command_window.set_handler(:medal, method(:command_medal))
end
#--------------------------------------------------------------------------
# ○ コマンド[メダル]
#--------------------------------------------------------------------------
def command_medal
SceneManager.call(Scene_Medal)
end
end
#==============================================================================
# □ Scene_Medal
#==============================================================================
class Scene_Medal < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_help_window
create_item_window
end
#--------------------------------------------------------------------------
# ○ アイテムウィンドウの作成
#--------------------------------------------------------------------------
def create_item_window
wy = @help_window.height
wh = Graphics.height - wy
@item_window = Window_Medal.new(0, wy, Graphics.width, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.set_handler(:cancel, method(:return_scene))
end
end