Ayene

Liczba postów: 758
Dołączył: 09-04-13
Pomógł: 112

|
Ayene's Quest Log
~ Ayene's Quest Log / Dziennik Misji Ayene ~
Krótki opis:
Skrypt pozwala na wprowadzenie systemu Dziennika Misji.
Sposób konfiguracji i wygląd Dziennika (ikony kategorii) inspirowany skryptem (Quest Journal VX) modern_algebry.
Autor:
Ayene
Skrypt:
#==============================================================================
# Ayene's Quest Log
# Autor: Ayene
# Wersja: 1.0
# forum.ultimateam.pl
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instrukcja:
# Skrypt pozwala na wprowadzenie systemu Dziennika Misji.
#
# Oto kilka wywołań, które pozawalają kontrolować Dziennik
# za pomocą polecenia "Script" w zdarzeniu:
#
# quest_new(id_misji) - aktywuje misję ze wszystkimi zadaniami.
#
# quest_task_new(id_misji, zadanie) - aktywuje wybrane zadanie misji
# quest_task_complete(id_misji, zadanie) - oznakowuje zadanie jako ukończone
# quest_task_fail(id_misji, zadanie) - oznakowuje zadanie jako nieudane
#
# quest_active?(id_misji) - sprawdza, czy misja jest aktywna
# quest_task_active?(id_misji, zadanie) - sprawdza, czy zadanie jest aktywne
# quest_complete?(id_misji) - sprawdza, czy misja jest ukończona
# quest_failed?(id_misji) - sprawdza, czy misja jest nieudana
#
# quest_delete(id) - usuwa całkowicie misję z listy
#
# Sposób konfiguracji i wygląd Dziennika (ikony kategorii) inspirowany
# skryptem (Quest Journal) modern_algebry.
#==============================================================================
# ** QuestLogConfig
#==============================================================================
module AYENE
module QuestLogConfig
# Wejście do Dziennika po wciśnięciu przycisku
MAPKEY = true
MAPKEY_BUTTON = Input::A
# ID przełącznika włączającego / wyłączającego Dziennik
DISABLED_SWITCH_ID = 1
# Plik z ikonami (Graphics/Icons)
QUEST_CAT_ICONS = "quest_icons"
# Kolory kategorii
COMPLETE_COLOR = Color.new(255, 80, 80, 255) # Ukończone
FAILED_COLOR = Color.new(80, 255, 80, 255) # Nieudane
# Słownik
LANG_CATEGORY_NAME = ["Misje aktywne", "Misje ukończone", "Misje nieudane", "Wszystkie misje"]
LANG_DIFFICULTY = "Trudność: "
LANG_DESCRIPTION = "Opis: "
LANG_TASKS = "Zadania: "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Data
#----------------------------------------------------------------------------
def self.quest(id)
tasks = []
name = '???'
description = '???'
difficulty = 1
case id
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * KONFIGURACJA MISJI
#------------------------------------------------------------------------
# Każda misja musi mieć przyporządkowane indywidualne ID.
#
# Ogólny wzór:
#
# when <id_misji>
# name = '<nazwa_misji>'
# description = '<opis_misji>'
# tasks[0] = '<pierwsze_zadanie>'
# ...
# tasks[8] = '<kolejne zadanie>'
# difficulty = <trudnosc_zadania>
#
# Powyższe parametry odpowiadają za:
# id : przyporządkowane ID misji [1..n]
# name : nazwa misji
# opis : krótka charakterystyka misji - maksymalnie dwie linijki
# tasks : poszczególne zadania w misji [0..8]
# difficulty : trudność misji oznakowana gwiazdkami [1..4]
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
when 1
name = 'Łatanie podłogi'
description = 'Twój dom potrzebuje gruntownego remontu.|Na początek załataj dziury w podłodze'
tasks[0] = 'Znajdź narzędzia.'
tasks[1] = 'Zdobądź deski.'
tasks[2] = 'Załataj dziury.'
difficulty = 1
when 2
name = 'Porządki'
description = 'Wypadałoby przed przyjściem gości nieco posprzątać.|Spraw, by było czysto i przytulnie.'
tasks[0] = 'Zbierz papiery i butelki z podłogi.'
tasks[1] = 'Rozpal w kominku.'
difficulty = 1
when 3
name = 'Pieczenie ciasta'
description = 'Musisz dbać o dobrosąsiedzkie stosunki.|Odwiedź sąsiada z blachą ciasta.'
tasks[0] = 'Upiecz ciasto.'
tasks[1] = 'Odwiedź sąsiada z ciastem.'
difficulty = 2
end
return name, description, tasks, difficulty
end
end
end
#==============================================================================
# ** Game_Quests
#==============================================================================
class Game_Quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :name
attr_reader :description
attr_reader :tasks
attr_reader :actived
attr_reader :completed
attr_reader :failed
attr_reader :difficulty
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(id)
@id = id
@name, @description, @tasks, @difficulty = AYENE::QuestLogConfig.quest(id)
@actived = []
@completed = []
@failed = []
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Task
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def new(index)
return unless index < @tasks.size
@actived |= [index]
@actived.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Complete Task
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def complete(index)
return unless index < @tasks.size
return if @failed.include?(index)
new(index) unless @actived.include?(index)
@completed |= [index]
@completed.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Uncomplete Task
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def uncomplete(index)
@complete.delete(index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Fail Task
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def fail(index)
return unless index < @tasks.size
new(index) unless @actived.include?(index)
@failed |= [index]
@failed.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Unfail Task
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def unfail(index)
@failed.delete(index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Active?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def active?
return @actived != []
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Active?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def actived?(index)
return @actived.include?(index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Complete?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def complete?
return @completed.size == @tasks.size
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Failed?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def failed?
return @failed != []
end
end
#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
include AYENE::QuestLogConfig
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization (aliased method)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias aye_quest_gmparty_ini initialize
def initialize
aye_quest_gmparty_ini
@quests = {}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest(id)
@quests[id] = Game_Quests.new(id) if @quests[id] == nil
return @quests[id]
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quests_list
return @quests.values
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Completed Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def completed_quests_list
list = []
quests_list.each {|quest| list.push(quest) if quest.complete? }
return list
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Failed Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def failed_quests_list
list = []
quests_list.each {|quest| list.push(quest) if quest.failed? }
return list
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Active Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def active_quests_list
return quests_list - completed_quests_list - failed_quests_list
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Delete Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def delete_quest(id)
@quests.delete(id)
end
end
#==============================================================================
# ** Interpreter
#==============================================================================
class Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add New Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_new(id)
$game_party.quest(id).tasks.each_index {|i| $game_party.quest(id).new(i)}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add New Task to the Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_task_new(id, task)
$game_party.quest(id).new(task)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Complete Quest Task
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_task_complete(id, task)
$game_party.quest(id).complete(task)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Fail Quest Task
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_task_fail(id, task)
$game_party.quest(id).fail(task)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check Quest Active?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_active?(id)
$game_party.quests[id].active? unless $game_party.quests[id].nil?
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check Quest Task Active?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_task_active?(id, task)
$game_party.quests[id].actived?(task) unless $game_party.quests[id].nil?
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check Quest Complete?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_complete?(id)
$game_party.quests[id].complete? unless $game_party.quests[id].nil?
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check Quest Failed?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_failed?(id)
$game_party.quests[id].failed? unless $game_party.quests[id].nil?
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Delete Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest_delete(id)
$game_party.delete_quest(id)
end
end
#==============================================================================
# ** Window_QuestHelp
#==============================================================================
class Window_QuestHelp < Window_Help
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize
super()
w, h = 224, 64
self.x, self.y, self.width, self.height = 0, 0, w, h
contents.dispose
self.contents = Bitmap.new (w - 32, h - 32)
end
#--------------------------------------------------------------------------
# * Set Text
#--------------------------------------------------------------------------
def set_text(text, align = 0)
super(text, 1)
end
end
#==============================================================================
# ** Window_QuestCategory
#==============================================================================
class Window_QuestCategory < Window_Selectable
include AYENE::QuestLogConfig
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 224, 64)
@item_max = 4
@column_max = @item_max
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max.times {|i| draw_item(i)}
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = Rect.new(0 + 32 * index, 0, 32, 32)
bitmap = RPG::Cache.icon(QUEST_CAT_ICONS)
self.contents.blt(8 + 48 * index, 0, bitmap, rect)
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(8 + @index * 48, 0, 32, 32)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.index > 4 ? "" : LANG_CATEGORY_NAME[index])
end
end
#==============================================================================
# ** Window_QuestList
#==============================================================================
class Window_QuestList < Window_Selectable
include AYENE::QuestLogConfig
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 128, 224, 352)
refresh
self.index = 0
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(category = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
case category
when 0
@data = $game_party.active_quests_list
when 1
@data = $game_party.completed_quests_list
when 2
@data = $game_party.failed_quests_list
when 3
@data = $game_party.quests_list
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
quest = @data[index]
y = index * 32
self.contents.font.color = normal_color
if quest.complete?
self.contents.font.color = FAILED_COLOR
end
if quest.failed?
self.contents.font.color = COMPLETE_COLOR
end
self.contents.draw_text(4, y, 204, 32, quest.name, 0)
end
end
#==============================================================================
# ** Window_QuestInfo_Name
#==============================================================================
class Window_QuestInfo_Name < Window_Selectable
include AYENE::QuestLogConfig
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(224, 0, 416, 64)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(quest = nil)
self.contents.clear
return if quest == nil
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 196, 32, quest.name, 0)
text = LANG_DIFFICULTY
w = self.contents.text_size(text).width
self.contents.draw_text(196, 0, w, 32, text, 0)
quest.difficulty.times {|i| draw_icon(196 + w + i*24, 0, 0)}
end
#--------------------------------------------------------------------------
# * Draw Icon
#--------------------------------------------------------------------------
def draw_icon(x, y, index)
rect = Rect.new(128 + 32 * index, 0, 32, 32)
bitmap = RPG::Cache.icon(QUEST_CAT_ICONS)
self.contents.blt(x, y, bitmap, rect)
end
end
#==============================================================================
# ** Window_QuestInfo_Description
#==============================================================================
class Window_QuestInfo_Description < Window_Selectable
include AYENE::QuestLogConfig
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(224, 64, 416, 128)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(quest = nil)
self.contents.clear
return if quest == nil
self.contents.font.color = crisis_color
self.contents.draw_text(4, 0, self.width - 40, 32, LANG_DESCRIPTION, 0)
self.contents.font.color = normal_color
self.contents.font.size -= 4
desc = quest.description.split(/\|/)
for i in 0...desc.size
self.contents.draw_text(4, 32 + i * 32, self.width - 40, 32, desc[i], 0)
end
self.contents.font.size += 4
end
end
#==============================================================================
# ** Window_QuestInfo_Tasks
#==============================================================================
class Window_QuestInfo_Tasks < Window_Selectable
include AYENE::QuestLogConfig
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(224, 192, 416, 288)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(quest = nil)
self.contents.clear
return if quest == nil
self.contents.font.color = crisis_color
self.contents.draw_text(4, 0, self.width - 40, 32, LANG_TASKS, 0)
self.contents.font.color = normal_color
self.contents.font.size -= 4
y = 32
quest.actived.each {|i|
task = quest.tasks[i]
self.contents.font.color = normal_color
if quest.completed.include?(i)
self.contents.font.color = FAILED_COLOR
draw_icon(0, y, 2)
elsif quest.failed.include?(i)
self.contents.font.color = COMPLETE_COLOR
draw_icon(0, y, 3)
else
draw_icon(0, y, 1)
end
self.contents.draw_text(32, y, self.width - 40, 32, task.to_s, 0)
y += 24
}
self.contents.font.size += 4
end
#--------------------------------------------------------------------------
# * Draw Icon
#--------------------------------------------------------------------------
def draw_icon(x, y, index)
rect = Rect.new(128 + 32 * index, 0, 32, 32)
bitmap = RPG::Cache.icon(QUEST_CAT_ICONS)
self.contents.blt(x, y, bitmap, rect)
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Frame Update (aliased method)
#--------------------------------------------------------------------------
alias aye_quest_scmap_update update
def update
aye_quest_scmap_update
if $game_temp.message_window_showing
return
end
return if !AYENE::QuestLogConfig::MAPKEY or $game_party.quests_list.empty? or $game_switches[AYENE::QuestLogConfig::DISABLED_SWITCH_ID]
if Input.trigger?(AYENE::QuestLogConfig::MAPKEY_BUTTON)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Quest.new
end
end
end
#==============================================================================
# ** Scene_Quest
#==============================================================================
class Scene_Quest
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@help_window = Window_QuestHelp.new
@category = Window_QuestCategory.new
@category.help_window = @help_window
@quest_list = Window_QuestList.new
@quest_info_name = Window_QuestInfo_Name.new
@quest_info_description = Window_QuestInfo_Description.new
@quest_info_tasks = Window_QuestInfo_Tasks.new
refresh_windows
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@category.dispose
@quest_list.dispose
@quest_info_name.dispose
@quest_info_description.dispose
@quest_info_tasks.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@category.update
@help_window.update
@quest_list.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
@quest_list.index = 0
@quest_list.refresh(@category.index)
refresh_windows
elsif Input.trigger?(Input::DOWN) or Input.trigger?(Input::UP)
refresh_windows
end
end
#--------------------------------------------------------------------------
# * Refresh Windows
#--------------------------------------------------------------------------
def refresh_windows
@quest_info_name.refresh(@quest_list.quest)
@quest_info_description.refresh(@quest_list.quest)
@quest_info_tasks.refresh(@quest_list.quest)
end
end
Screeny:
Demo:
Wymagana grafika:
Umieść ją w folderze Graphics/Icons
Dodatkowe informacje:
Oto kilka wywołań, które pozawalają kontrolować Dziennik za pomocą polecenia "Script" w zdarzeniu:
quest_new(id_misji) - aktywuje misję ze wszystkimi zadaniami.
quest_task_new(id_misji, zadanie) - aktywuje wybrane zadanie misji
quest_task_complete(id_misji, zadanie) - oznakowuje zadanie jako ukończone
quest_task_fail(id_misji, zadanie) - oznakowuje zadanie jako nieudane
quest_active?(id_misji) - sprawdza, czy misja jest aktywna
quest_task_active?(id_misji, zadanie) - sprawdza, czy zadanie jest aktywne
quest_complete?(id_misji) - sprawdza, czy misja jest ukończona
quest_failed?(id_misji) - sprawdza, czy misja jest nieudana
quest_delete(id) - usuwa całkowicie misję z listy
|
|