sacred-ritual-academy/Scripts/_RGSS3_Ver1_01_by_.rb
2025-03-18 19:45:34 -05:00

80 lines
No EOL
3 KiB
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ■ RGSS3 アイテムカラー変更 Ver1.01 by 星潟
#------------------------------------------------------------------------------
# このスクリプトを導入することでアイテム名の表示色を変更できます。
# なお、スキル名の表示色も変更可能です。
#
# 当方の自動戦闘時のスキル封印スクリプトを使用されている場合は
# 自動戦闘時のスキル封印スクリプトをこのスクリプトより下に配置しなければ
# 正常に動作しないのでご注意ください。
#
# 使用例 <アイテムカラー:10>
# このアイテム・スキルの名前表示はテキストカラー10番になる。
#------------------------------------------------------------------------------
# Ver1.01 色々と処理形式を変更しました。
#==============================================================================
module ITEM_COLOR
#アイテムカラー指定用のキーワード
WORD = "アイテムカラー"
end
class Window_Base < Window
#--------------------------------------------------------------------------
# 通常文字色
#--------------------------------------------------------------------------
alias normal_color_item_color normal_color
def normal_color
#色変更データが存在する場合はそのデータへ。
#そうでない場合は
@normal_color_change ? text_color(@normal_color_change) : normal_color_item_color
end
#--------------------------------------------------------------------------
# アイテム名の描画
#--------------------------------------------------------------------------
alias draw_item_name_color_change draw_item_name
def draw_item_name(item, x, y, enabled = true, width = 172)
#アイテムが存在し、なおかつアイテムカラーの設定が存在する場合
#通常文字色変更データを用意。
@normal_color_change = item.item_color if item && item.item_color
#本来の処理を実行。
draw_item_name_color_change(item, x, y, enabled, width)
#通常文字色変更データを消去。
@normal_color_change = nil
end
end
class RPG::BaseItem
#--------------------------------------------------------------------------
# アイテムカラー
#--------------------------------------------------------------------------
def item_color
#キャッシュが存在する場合はキャッシュを返す。
return @item_color if @item_color
#メモ欄からデータを取得。
memo = @note.scan(/<#{ITEM_COLOR::WORD}[:](\S+)>/).flatten
#有効なデータである場合は習得したデータを、そうでない場合はfalseを返す。
@item_color = memo != nil && !memo.empty? ? memo[0].to_i : false
#データを返す。
@item_color
end
end