PHP код:
=begin
================================================================================
Item Almanac v1.2
by wltr3565
================================================================================
This is mainly for my project. No item library scripts or something for items?
Come on, why only enemies?! We need an item library for hardcore collecting
challenges, you know!
================================================================================
Features:
- Auto flag for acquired items!
- Customizeable for list showing between items, weapons, and armors!
- Integration with variables!
- Easy use of script commands!
- Auto command install! (Thanks to KGC)
- Commentary for items! (Thanks to Yanfly)
- Flag between collectible items and uncollectible items! In case for key items.
- PLUG AND PLAY! If you're lazy to setup this.
================================================================================
How it will work:
This script tracks your item collection. If you get an item, the item will be
flaged that you already had it. And your collected items will be shown in the
almanac. You can check the item collecting progession via script command that
will be instructed below.
================================================================================
How to Use:
There are several functions available in the items'(Items, Weapons, and Armors)
note tags:
- <Almanac out>
If an item has that tag included, that item will not be added in the almanac,
no matter what. Suggested if the item is a key item. More information can be
read at DEFAULT_DOCUMENTATION.
- <Almanac com_on> text <Almanac com_off>
That tag will make the comment for the item. The comment will be shown in the
almanac. The text between the tags will be the one to be shown as the comment.
You can use several message functions for the text like /n and /v. Don't forget
to add | for each new lines. The use is like this:
<almanac com_on>
comment
<almanac com_off>
- <Almanac graphic name>
The items' image. Only useful when GRAPHIC_USE below is true. The item's image
must be added in Graphics/Pictures folder.
Example:
<Almanac graphic club>
You'll have an image with a filename "club" for the item's image.
And some script commands to access the almanac for events (inside [] is
optional):
- $game_system.complete_almanac
That command will make the almanac to be fully completed. I suggest to NOT use
it for the main gameplay. That command will ruin the collecting fun because
the collection is already complete!
- $game_system.check_item_get(code, id)
This will check if the item has been recorded in the almanac. Suggested to use
in conditional branches. Code is the item code, between "I", "W", and "A". "I"
for items, "W" for weapons, and "A" for armors. The id is for the item's id to
check. Example:
$game_system.check_item_get("A", 5)
That will check if you've already got the Armor ID 5.
- $game_system.flag_item_get(code, id[, flag])
This will alter the almanac record. between "I", "W", and "A". "I"
for items, "W" for weapons, and "A" for armors. The id is for the item's id,
like this:
$game_system.flag_item_get("I", 2, false)
That will alter the record of getting Item ID 2 to false (Like you haven't got
it).
If you write it like this:
$game_system.flag_item_get("W", 2)
That will alter the record of getting Weapon ID 2 to true (Like you already got
it, even if you haven't).
- $game_system.check_item_completition[(code)]
This will check if you've already completed the almanac. Returns to true if
the almanac is already completed. Vice versa if the almanac has not yet been
completed. Code represents the item code, "I", "W", and "A". You can mix them
like "IW" (checks both items and weapons) or "WA" (checks both weapons and
armors). Writing simply $game_system.check_item_completition will check all
items (Items, weapons, and armors).
- $game_system.check_item_completition_rate[(code, variable)]
This will get the completition rate of the almanac of the said code. Variable
represents the variable to store the rate, like this:
$game_system.check_item_completition_rate("IA", 10)
That will calculate the completition rate of items and armors, and the rate
will be recorded in variable ID 10. Simply write
$game_system.check_item_completition_rate will check all items (Items, weapons,
and armors) without storing the rate to a variable. For conditional branches.
I don't really suggest to store the rate to a variable since the rate will be
in a decimal value and might give errors while using that. Use this function
at your own risk!
- $game_system.check_item_total[(code, variable)]
This will check the total of available items to be recorded of the said code,
like this:
$game_system.check_item_total("A", 5)
That will count the total of collectible armors and store the count in variable
ID 5.
- $game_system.check_item_get_total[(code, variable)]
Like above, but for counting the collected items.
- $scene = Scene_Almanac.new[(code)]
This will open the almanac scene.
You can do more configurations below.
================================================================================
Install:
Insert this above main.
================================================================================
Terms of Use:
Credit me, wltr3565. For commercial uses, contact me so your game can be
included in my free-to-play lists :D. Crediting who I thanked will be a good
idea.
================================================================================
Thanks:
Capcom: Megaman Battle Network's chip collecting frenzy!
Yanfly: Method for commenting.
KGC: Method for adding command in the menu.
================================================================================
=end
#===============================================================================
# COMMENCING COMPATIBILITY FLAG
#===============================================================================
$imported = {} if $imported == nil
$imported["wltr3565's_Item_Almanac"] = true
#===============================================================================
# END COMPATIBILITY FLAG
#===============================================================================
module WLTR
module ALMANAC_SETUP
#===============================================================================
# The letter used if the corresponding item is not yet known. Defaultly "?".
# If the unknown item is named Calibur, the result will be ???????.
#===============================================================================
UNKNOWN_WORD = "?"
#===============================================================================
# The icon id used if the item is not yet known.
#===============================================================================
UNKNOWN_ICON = 50
#===============================================================================
# Help description for unknown items. Write it in a string.
#===============================================================================
UNKNOWN_HELP = "???"
#===============================================================================
# This will toggle the <Almanac out>'s function.
# true : Items with <Almanac out> tag will not be added in the almanac.
# false : Items without <Almanac out> tag will not be added in the almanac.
#===============================================================================
DEFAULT_DOCUMENTATION = true
#===============================================================================
# Comment for unknown items. Write it in the string.
#===============================================================================
UNKNOWN_COMMENT = ""
#===============================================================================
# Image filename for unknown items. Write it in a string. Useable only if
# GRAPHIC_USE is true.
#===============================================================================
UNKNOWN_GRAPHIC = ""
#===============================================================================
# Space for the item graphic.
#===============================================================================
ITEM_GRAPH_HEIGHT = 208
#===============================================================================
# Text for the page 1 that will tell the item's type. Page 1 will only be
# shown if GRAPHIC_USE is true. Add %s for the type.
#===============================================================================
PAGE_1_TEXT = "Type = %s"
#===============================================================================
# The almanac type for show in menu. Type is for deciding the items available
# to be shown.
# "I" = Show items only.
# "W" = Show weapons only.
# "A" = Show armors only.
# "IW" = Show both items and weapons.
# "IA" = Show both items and armors.
# "WA" = Show both weapons and armors.
# "IWA" = Show all of them.
#===============================================================================
ALMANAC_SHOW_MENU = "IWA"
#===============================================================================
# Checks if you want to use graphics for items.
# true = use
# false = don't use
#===============================================================================
GRAPHIC_USE = false
#===============================================================================
# The sfx while flipping between item pages. The format is:
# PAGE_FLIP_SE = [filename, volume, pitch]
#===============================================================================
PAGE_FLIP_SE = ["Book", 80, 100]
#===============================================================================
# The background image while opening the almanac. The image must be put in
# Graphics/System folder. Just write "" if you don't want to use one.
#===============================================================================
BACKGROUND = ""
#===============================================================================
# Checks if you want to let the option for opening the almanac via menu.
# true = make it available to access via menu.
# false = make it not available to access via menu.
#===============================================================================
ADD_TO_MENU = true
#===============================================================================
# The command's name for opening the almanac. Write it in a string.
#===============================================================================
ALMANAC_NAME = "Item Almanac"
#===============================================================================
# These will set the icons for coressponding attributes.
#===============================================================================
ITEM_ICON = 144 # Item
WEAPON_ICON = 2 # Weapon
ARMOR_ICON = 41 # Armor
ELEMENT_ICONS = {
# id => icon_id
9 => 104, # Fire
10 => 105, # Ice
11 => 106, # Thunder
12 => 107, # Water
13 => 108, # Earth
14 => 109, # Wind
15 => 110, # Holy
16 => 111, # Darkness
}
#===============================================================================
# Set's the elements available to be shown
#===============================================================================
ELEMENTS_SHOWN = [9, 10, 11, 12, 13, 14, 15, 16]
#===============================================================================
# Setting the icons again.
#===============================================================================
PRICE_ICON = 85
HRECOVERY_PER_ICON = 64
HRECOVERY_ICON = 64
MRECOVERY_PER_ICON = 65
MRECOVERY_ICON = 65
HP_ICON = 96
MP_ICON = 97
ATK_ICON = 1
DEF_ICON = 52
SPI_ICON = 18
MDF_ICON = 57
AGI_ICON = 48
#===============================================================================
# This will set the words for corresponding attributes. Always add the % things
# if there's one. Like "HP Heal = %d". Keep the %d in the new one.
#===============================================================================
HP_REC_TEXT = "HP Heal = %d"
HP_PER_TEXT = "HP Heal = %d%"
HP_TEXT = "MaxHP = %d"
MP_REC_TEXT = "MP Heal = %d"
MP_PER_TEXT = "MP Heal = %d%"
MP_TEXT = "MaxMP = %d"
ATK_TEXT = "Attack = %d"
DEF_TEXT = "Defense = %d"
SPI_TEXT = "Intellegence = %d"
MDF_TEXT = "Resistance = %d"
AGI_TEXT = "Speed = %d"
STATUS_ADD_TEXT = "Status Effects"
STATUS_REMOVE_TEXT ="Status Remove"
STATUS_GUARD_TEXT = "Status Resistance"
ELEMENT_ADD = "Attack Elements"
ELEMENT_GUARD = "Element Resistance"
PRICE_TEXT = "Cost = %d %s"
PARAMETER_TEXT = "Parameter Boost"
NO_STATUS_TEXT = "None"
PERCENTAGE_SHOW = "Collection Rate = %10.2f%"
end
"=============================================================================="
" BELOW IS TOO DANGEROUS TO READ WITHOUT PROPER SCRIPTING SKILLS. THEREFOR, "
" EDIT AT YOUR OWN RISK! "
"=============================================================================="
module ALMANAC_REGEXP
DONT_INCLUDE = /<Almanac out>/i
COMMENT_ON = /<Almanac com_on>/i
COMMENT_OFF = /<Almanac com_off>/i
GRAPHIC = /<Almanac graphic[ ]*(\w+)>/i
end
end
module RPG
class BaseItem
attr_accessor :include_flag
attr_accessor :comment
attr_accessor :graphic
def scan_almanac_property
@include_flag = WLTR::ALMANAC_SETUP::DEFAULT_DOCUMENTATION
@comment = ""; @graphic = "";
start_comment_scan
self.note.split(/[\r\n]+/).each { |line|
case line
when WLTR::ALMANAC_REGEXP::DONT_INCLUDE
@include_flag = (!WLTR::ALMANAC_SETUP::DEFAULT_DOCUMENTATION)
when WLTR::ALMANAC_REGEXP::GRAPHIC
@graphic = $1.to_s
end
}
end
def start_comment_scan
read = false
self.note.split(/[\r\n]+/).each { |line|
case line
when WLTR::ALMANAC_REGEXP::COMMENT_ON
read = true
when WLTR::ALMANAC_REGEXP::COMMENT_OFF
read = false
else
if read
@comment += line
end
end
}
@comment = WLTR::ALMANAC_SETUP::UNKNOWN_COMMENT if @comment == ""
end
end
end
class Game_System
attr_accessor :almanac
alias almanac_make initialize
def initialize
almanac_make
@almanac = {
"I" => make_item_blank_record,
"W" => make_weapon_blank_record,
"A" => make_armor_blank_record,
}
end
def make_item_blank_record
result = {}
(1...$data_items.size).each { |i|
item = $data_items[i]
item.scan_almanac_property
result[item.id] = false if item.include_flag
}
return result
end
def make_weapon_blank_record
result = {}
(1...$data_weapons.size).each { |i|
item = $data_weapons[i]
item.scan_almanac_property
result[item.id] = false if item.include_flag
}
return result
end
def make_armor_blank_record
result = {}
(1...$data_armors.size).each { |i|
item = $data_armors[i]
item.scan_almanac_property
result[item.id] = false if item.include_flag
}
return result
end
def complete_almanac
(1...$data_items.size).each { |i|
item = $data_items[i]
next if !item.include_flag
@almanac["I"][item.id] = true
}
(1...$data_weapons.size).each { |i|
item = $data_weapons[i]
next if !item.include_flag
@almanac["W"][item.id] = true
}
(1...$data_armors.size).each { |i|
item = $data_armors[i]
next if !item.include_flag
@almanac["A"][item.id] = true
}
end
def check_item_get(code, id)
return @almanac[code][id]
end
def flag_item_get(code, id, flag = true)
@almanac[code][id] = flag
end
def check_item_completition(code = "IWA")
if code.include?("I")
(1...$data_items.size).each { |i|
item = $data_items[i]
next if !item.include_flag
return false unless @almanac["I"][item.id] == true
}
end
if code.include?("W")
(1...$data_weapons.size).each { |i|
item = $data_weapons[i]
next if !item.include_flag
return false unless @almanac["W"][item.id] == true
}
end
if code.include?("A")
(1...$data_armors.size).each { |i|
item = $data_armors[i]
next if !item.include_flag
return false unless @almanac["A"][item.id] == true
}
end
return true
end
def check_item_completition_rate(code = "IWA", variable = nil)
total = 0
total += @almanac["I"].size if code.include?("I")
total += @almanac["W"].size if code.include?("W")
total += @almanac["A"].size if code.include?("A")
get = 0
if code.include?("I")
(1...$data_items.size).each { |i|
item = $data_items[i]
next if !item.include_flag
get += 1 if @almanac["I"][item.id] == true
}
end
if code.include?("W")
(1...$data_weapons.size).each { |i|
item = $data_weapons[i]
next if !item.include_flag
get += 1 if @almanac["W"][item.id] == true
}
end
if code.include?("A")
(1...$data_armors.size).each { |i|
item = $data_armors[i]
next if !item.include_flag
get += 1 if @almanac["A"][item.id] == true
}
end
result = 100.0 * get / total
$game_variables[variable] = result if variable != nil
return result
end
def check_item_total(code = "IWA", variable = nil)
total = 0
total += @almanac["I"].size if code.include?("I")
total += @almanac["W"].size if code.include?("W")
total += @almanac["A"].size if code.include?("A")
$game_variables[variable] = total if variable != nil
return total
end
def check_item_get_total(code = "IWA", variable = nil)
get = 0
if code.include?("I")
(1...$data_items.size).each { |i|
item = $data_items[i]
next if !item.include_flag
get += 1 if @almanac["I"][item.id] == true
}
end
if code.include?("W")
(1...$data_weapons.size).each { |i|
item = $data_weapons[i]
next if !item.include_flag
get += 1 if @almanac["W"][item.id] == true
}
end
if code.include?("A")
(1...$data_armors.size).each { |i|
item = $data_armors[i]
next if !item.include_flag
get += 1 if @almanac["A"][item.id] == true
}
end
$game_variables[variable] = get if variable != nil
return get
end
end
class Game_Party < Game_Unit
alias item_record gain_item
def gain_item(item, n, include_equip = false)
item_record(item, n, include_equip)
case item
when RPG::Item
$game_system.almanac["I"][item.id] = true
when RPG::Weapon
$game_system.almanac["W"][item.id] = true
when RPG::Armor
$game_system.almanac["A"][item.id] = true
end
end
end
class Window_Item_Almanac_List < Window_Selectable
def initialize(x, y, width, height, type = "I")
super(x, y, width, height)
@type = type
if type.size == 2
if type == "IW"
@item_max = $game_system.almanac["I"].size + $game_system.almanac["W"].size
elsif type == "IA"
@item_max = $game_system.almanac["I"].size + $game_system.almanac["A"].size
elsif type == "WA"
@item_max = $game_system.almanac["W"].size + $game_system.almanac["A"].size
end
elsif type == "IWA"
@item_max = ($game_system.almanac["I"].size + $game_system.almanac["W"].size + $game_system.almanac["A"].size)
else
@item_max = $game_system.almanac[@type].size
end
create_contents
self.opacity = 0 if WLTR::ALMANAC_SETUP::BACKGROUND != ""
@real_index = 0
@real_item_id = []
@index = 0
draw_list
end
def item
case @type
when "I"; return $data_items[@real_item_id[@index]]
when "W"; return $data_weapons[@real_item_id[@index]]
when "A"; return $data_armors[@real_item_id[@index]]
end
if @type.size == 2
if @type == "IW"
if @index > $game_system.almanac["I"].size - 1
return $data_weapons[@real_item_id[@index]]
else
return $data_items[@real_item_id[@index]]
end
elsif @type == "IA"
if @index > $game_system.almanac["I"].size - 1
return $data_armors[@real_item_id[@index]]
else
return $data_items[@real_item_id[@index]]
end
elsif @type == "WA"
if @index > $game_system.almanac["W"].size - 1
return $data_armors[@real_item_id[@index]]
else
return $data_weapons[@real_item_id[@index]]
end
end
end
if @type == "IWA"
if @index > $game_system.almanac["I"].size + $game_system.almanac["W"].size - 1
return $data_armors[@real_item_id[@index]]
elsif @index > $game_system.almanac["I"].size - 1
return $data_weapons[@real_item_id[@index]]
else
return $data_items[@real_item_id[@index]]
end
end
end
def draw_list
case @type
when "I"; size = $data_items.size
when "W"; size = $data_weapons.size
when "A"; size = $data_armors.size
end
if @type.size == 2
if @type == "IW"
size = $data_items.size + $data_weapons.size
elsif @type == "IA"
size = $data_items.size + $data_armors.size
elsif @type == "WA"
size = $data_weapons.size + $data_armors.size
end
size -= 1
end
if @type == "IWA"
size = $data_items.size + $data_weapons.size + $data_armors.size
size -= 2
end
for index in 1...size
case @type
when "I"; item = $data_items[index]
when "W"; item = $data_weapons[index]
when "A"; item = $data_armors[index]
end
if @type.size == 2
if @type == "IW"
if index > $data_items.size - 1
item = $data_weapons[index - $data_items.size + 1]
else
item = $data_items[index]
end
elsif @type == "IA"
if index > $data_items.size - 1
item = $data_armors[index - $data_items.size + 1]
else
item = $data_items[index]
end
elsif @type == "WA"
if index > $data_weapons.size - 1
item = $data_armors[index - $data_weapons.size + 1]
else
item = $data_weapons[index]
end
end
end
if @type == "IWA"
if index > $data_items.size + $data_weapons.size - 2
item = $data_armors[index - $data_weapons.size - $data_items.size + 2]
elsif index > $data_items.size - 1
item = $data_weapons[index - $data_items.size + 1]
else
item = $data_items[index]
end
end
draw_item(index) if item.include_flag
end
end
def draw_item(index)
@real_index += 1
case @type
when "I"; item = $data_items[index]
when "W"; item = $data_weapons[index]
when "A"; item = $data_armors[index]
end
if @type.size == 2
if @type == "IW"
if index > $data_items.size - 1
item = $data_weapons[index - $data_items.size + 1]
else
item = $data_items[index]
end
elsif @type == "IA"
if index > $data_items.size - 1
item = $data_armors[index - $data_items.size + 1]
else
item = $data_items[index]
end
elsif @type == "WA"
if index > $data_weapons.size - 1
item = $data_armors[index - $data_weapons.size + 1]
else
item = $data_weapons[index]
end
end
end
if @type == "IWA"
if index > $data_items.size + $data_weapons.size - 2
item = $data_armors[index - $data_weapons.size - $data_items.size + 2]
elsif index > $data_items.size - 1
item = $data_weapons[index - $data_items.size + 1]
else
item = $data_items[index]
end
end
rect = item_rect(@real_index - 1)
self.contents.clear_rect(rect)
if item != nil
case item
when RPG::Item
code = "I"
when RPG::Weapon
code = "W"
when RPG::Armor
code = "A"
end
known = $game_system.almanac[code][item.id]
@real_item_id << item.id
name = item.name
icon = item.icon_index
if !known
count = name.size + 1
icon = WLTR::ALMANAC_SETUP::UNKNOWN_ICON
name = ""
for i in 1...count
name += WLTR::ALMANAC_SETUP::UNKNOWN_WORD
end
end
rect.width -= 4
self.contents.draw_text(0, rect.y, 24, rect.height, sprintf("%2d", @real_index), 2)
draw_icon(icon, 24, rect.y, true)
self.contents.draw_text(rect.x + 48, rect.y, 172, WLH, name)
end
end
def update_help
des = item.description
case item
when RPG::Item
code = "I"
when RPG::Weapon
code = "W"
when RPG::Armor
code = "A"
end
des = WLTR::ALMANAC_SETUP::UNKNOWN_HELP if !$game_system.check_item_get(code, item.id)
@help_window.set_text(item == nil ? "" : des)
end
end
class Window_Almanac_Item_Status < Window_Base
attr_accessor :item
attr_accessor :page
def initialize(x, y, width, height, item, page = 1)
super(x, y, width, height)
@item = item
@page = page
refresh(@page)
self.opacity = 0 if WLTR::ALMANAC_SETUP::BACKGROUND != ""
end
def refresh(page)
@page = page
self.contents.clear
case item
when RPG::Item
code = "I"
when RPG::Weapon
code = "W"
when RPG::Armor
code = "A"
end
known = $game_system.almanac[code][item.id]
if !known
draw_icon(WLTR::ALMANAC_SETUP::UNKNOWN_ICON, 0, 0, true)
count = item.name.size + 1
name = ""
for i in 1...count
name += WLTR::ALMANAC_SETUP::UNKNOWN_WORD
end
self.contents.draw_text(24, 0, 172, WLH, name)
# Took from Yanfly's
dy = WLH * 2
x = 8
y = WLH * 2
text = WLTR::ALMANAC_SETUP::UNKNOWN_COMMENT
return if text == nil
txsize = 24
nwidth = 500
dx = 28; dy = WLH * 2
text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
lines = text.split(/(?:[|]|\\n)/i)
lines.each_with_index { |l, i|
l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
self.contents.draw_text(0, i * txsize + dy, nwidth, WLH, l, 0)}
else
draw_item_name(item, 0, 0)
case item
when RPG::Item
icon = WLTR::ALMANAC_SETUP::ITEM_ICON
when RPG::Weapon
icon = WLTR::ALMANAC_SETUP::WEAPON_ICON
when RPG::Armor
icon = WLTR::ALMANAC_SETUP::ARMOR_ICON
end
draw_icon(icon, self.width - 60, 0, true)
page += 1 if !WLTR::ALMANAC_SETUP::GRAPHIC_USE
case page
when 1
graph = Cache.picture(item.graphic)
w = graph.width
self.contents.blt((self.width / 2) - (w / 2) , WLH, graph, graph.rect)
case item
when RPG::Item
type = Vocab::item
when RPG::Weapon
type = Vocab::weapon
when RPG::Armor
type = Vocab::armor3
end
y = WLTR::ALMANAC_SETUP::ITEM_GRAPH_HEIGHT
y = WLH if item.graphic == ""
self.contents.draw_text(0, y, self.width, 24, sprintf(WLTR::ALMANAC_SETUP::PAGE_1_TEXT, type))
when 2
case item
when RPG::Item
draw_icon(WLTR::ALMANAC_SETUP::HRECOVERY_ICON, 0, WLH*2, true)
self.contents.draw_text(24, WLH * 2, 272, 24, sprintf(WLTR::ALMANAC_SETUP::HP_REC_TEXT, item.hp_recovery))
draw_icon(WLTR::ALMANAC_SETUP::HRECOVERY_PER_ICON, 0, WLH*3, true)
self.contents.draw_text(24, WLH * 3, 272, 24, sprintf(WLTR::ALMANAC_SETUP::HP_PER_TEXT, item.hp_recovery_rate))
draw_icon(WLTR::ALMANAC_SETUP::MRECOVERY_ICON, 0, WLH*4, true)
self.contents.draw_text(24, WLH * 4, 272, 24, sprintf(WLTR::ALMANAC_SETUP::MP_REC_TEXT, item.mp_recovery))
draw_icon(WLTR::ALMANAC_SETUP::MRECOVERY_PER_ICON, 0, WLH*5, true)
self.contents.draw_text(24, WLH * 5, 272, 24, sprintf(WLTR::ALMANAC_SETUP::MP_PER_TEXT, item.mp_recovery_rate))
self.contents.draw_text(24, WLH * 6, 272, 24, WLTR::ALMANAC_SETUP::STATUS_ADD_TEXT)
x = 0
for state in item.plus_state_set
status = $data_states[state]
draw_icon(status.icon_index, x, WLH * 7, true)
x += 24
end
self.contents.draw_text(24, WLH * 8, 272, 24, WLTR::ALMANAC_SETUP::STATUS_REMOVE_TEXT)
x = 0
for state in item.minus_state_set
status = $data_states[state]
draw_icon(status.icon_index, x, WLH * 9, true)
x += 24
end
draw_icon(WLTR::ALMANAC_SETUP::PRICE_ICON, 0, WLH*10, true)
self.contents.draw_text(24, WLH * 10, 272, 24, sprintf(WLTR::ALMANAC_SETUP::PRICE_TEXT, item.price, Vocab::gold))
self.contents.draw_text(0, WLH * 11, 272, 24, WLTR::ALMANAC_SETUP::PARAMETER_TEXT, 1)
case item.parameter_type
when 0
self.contents.draw_text(0, WLH * 12, 272, 24, WLTR::ALMANAC_SETUP::NO_STATUS_TEXT, 1)
when 1
draw_icon(WLTR::ALMANAC_SETUP::HP_ICON, 0, WLH * 12, true)
self.contents.draw_text(24, WLH * 12, 272, 24, sprintf(WLTR::ALMANAC_SETUP::HP_TEXT, item.parameter_points))
when 2
draw_icon(WLTR::ALMANAC_SETUP::MP_ICON, 0, WLH * 12, true)
self.contents.draw_text(24, WLH * 12, 272, 24, sprintf(WLTR::ALMANAC_SETUP::MP_TEXT, item.parameter_points))
when 3
draw_icon(WLTR::ALMANAC_SETUP::ATK_ICON, 0, WLH * 12, true)
self.contents.draw_text(24, WLH * 12, 272, 24, sprintf(WLTR::ALMANAC_SETUP::ATK_TEXT, item.parameter_points))
when 4
draw_icon(WLTR::ALMANAC_SETUP::DEF_ICON, 0, WLH * 12, true)
self.contents.draw_text(24, WLH * 12, 272, 24, sprintf(WLTR::ALMANAC_SETUP::DEF_TEXT, item.parameter_points))
when 5
draw_icon(WLTR::ALMANAC_SETUP::SPI_ICON, 0, WLH * 12, true)
self.contents.draw_text(24, WLH * 12, 272, 24, sprintf(WLTR::ALMANAC_SETUP::SPI_TEXT, item.parameter_points))
when 6
draw_icon(WLTR::ALMANAC_SETUP::AGI_ICON, 0, WLH * 12, true)
self.contents.draw_text(24, WLH * 12, 272, 24, sprintf(WLTR::ALMANAC_SETUP::AGI_TEXT, item.parameter_points))
end
when RPG::Weapon
draw_icon(WLTR::ALMANAC_SETUP::ATK_ICON, 0, WLH * 2, true)
self.contents.draw_text(24, WLH * 2, 200, 24, sprintf(WLTR::ALMANAC_SETUP::ATK_TEXT, item.atk), 2)
draw_icon(WLTR::ALMANAC_SETUP::DEF_ICON, 0, WLH * 3, true)
self.contents.draw_text(24, WLH * 3, 200, 24, sprintf(WLTR::ALMANAC_SETUP::DEF_TEXT, item.def), 2)
draw_icon(WLTR::ALMANAC_SETUP::SPI_ICON, 0, WLH * 4, true)
self.contents.draw_text(24, WLH * 4, 200, 24, sprintf(WLTR::ALMANAC_SETUP::SPI_TEXT, item.spi), 2)
if defined?(CSU) != nil
draw_icon(WLTR::ALMANAC_SETUP::AGI_ICON, 0, WLH * 6, true) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
self.contents.draw_text(24, WLH * 6, 200, 24, sprintf(WLTR::ALMANAC_SETUP::AGI_TEXT, item.agi), 2) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
else
draw_icon(WLTR::ALMANAC_SETUP::AGI_ICON, 0, WLH * 5, true)
self.contents.draw_text(24, WLH * 5, 200, 24, sprintf(WLTR::ALMANAC_SETUP::AGI_TEXT, item.agi), 2)
end
if defined?(CSU)
draw_icon(WLTR::ALMANAC_SETUP::MDF_ICON, 0, WLH * 5, true) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
self.contents.draw_text(24, WLH * 5, 200, 24, sprintf(WLTR::ALMANAC_SETUP::MDF_TEXT, item.mdf), 2) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
end
self.contents.draw_text(24, WLH * 7, 200, 24, WLTR::ALMANAC_SETUP::ELEMENT_ADD)
x = 0
for el in item.element_set
next unless WLTR::ALMANAC_SETUP::ELEMENTS_SHOWN.include?(el)
draw_icon(WLTR::ALMANAC_SETUP::ELEMENT_ICONS[el], x, WLH * 8, true)
x += 24
end
self.contents.draw_text(24, WLH * 9, 200, 24, WLTR::ALMANAC_SETUP::STATUS_ADD_TEXT)
x = 0
for state in item.state_set
status = $data_states[state]
draw_icon(status.icon_index, x, WLH * 10, true)
x += 24
end
draw_icon(WLTR::ALMANAC_SETUP::PRICE_ICON, 0, WLH*11, true)
self.contents.draw_text(24, WLH * 11, 272, 24, sprintf(WLTR::ALMANAC_SETUP::PRICE_TEXT, item.price, Vocab::gold))
when RPG::Armor
draw_icon(WLTR::ALMANAC_SETUP::ATK_ICON, 0, WLH * 2, true)
self.contents.draw_text(24, WLH * 2, 200, 24, sprintf(WLTR::ALMANAC_SETUP::ATK_TEXT, item.atk), 2)
draw_icon(WLTR::ALMANAC_SETUP::DEF_ICON, 0, WLH * 3, true)
self.contents.draw_text(24, WLH * 3, 200, 24, sprintf(WLTR::ALMANAC_SETUP::DEF_TEXT, item.def), 2)
draw_icon(WLTR::ALMANAC_SETUP::SPI_ICON, 0, WLH * 4, true)
self.contents.draw_text(24, WLH * 4, 200, 24, sprintf(WLTR::ALMANAC_SETUP::SPI_TEXT, item.spi), 2)
if defined?(CSU) != nil
draw_icon(WLTR::ALMANAC_SETUP::AGI_ICON, 0, WLH * 6, true) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
self.contents.draw_text(24, WLH * 6, 200, 24, sprintf(WLTR::ALMANAC_SETUP::AGI_TEXT, item.agi), 2) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
else
draw_icon(WLTR::ALMANAC_SETUP::AGI_ICON, 0, WLH * 5, true)
self.contents.draw_text(24, WLH * 5, 200, 24, sprintf(WLTR::ALMANAC_SETUP::AGI_TEXT, item.agi), 2)
end
if defined?(CSU)
draw_icon(WLTR::ALMANAC_SETUP::MDF_ICON, 0, WLH * 5, true) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
self.contents.draw_text(24, WLH * 5, 200, 24, sprintf(WLTR::ALMANAC_SETUP::MDF_TEXT, item.mdf), 2) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
end
self.contents.draw_text(24, WLH * 7, 200, 24, WLTR::ALMANAC_SETUP::ELEMENT_GUARD)
x = 0
for el in item.element_set
next unless WLTR::ALMANAC_SETUP::ELEMENTS_SHOWN.include?(el)
draw_icon(WLTR::ALMANAC_SETUP::ELEMENT_ICONS[el], x, WLH * 8, true)
x += 24
end
self.contents.draw_text(24, WLH * 9, 200, 24, WLTR::ALMANAC_SETUP::STATUS_GUARD_TEXT)
x = 0
for state in item.state_set
status = $data_states[state]
draw_icon(status.icon_index, x, WLH * 10, true)
x += 24
end
draw_icon(WLTR::ALMANAC_SETUP::PRICE_ICON, 0, WLH*11, true)
self.contents.draw_text(24, WLH * 11, 272, 24, sprintf(WLTR::ALMANAC_SETUP::PRICE_TEXT, item.price, Vocab::gold))
end
when 3
# Took from Yanfly's
dy = WLH * 2
x = 8
y = WLH * 2
text = @item.comment
return if text == nil
txsize = 24
nwidth = 500
dx = 28; dy = WLH * 2
text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
lines = text.split(/(?:[|]|\\n)/i)
lines.each_with_index { |l, i|
l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
self.contents.draw_text(0, i * txsize + dy, nwidth, WLH, l, 0)}
else
custom_page(page)
end
end
end
def custom_page(page)
#===============================================================================
# Add your own custom script here if you want to add extra part of item pages.
#===============================================================================
end
end
class Scene_Almanac < Scene_Base
def initialize(type = "IWA")
@type = type
end
def start
super
create_menu_background
if WLTR::ALMANAC_SETUP::BACKGROUND != ""
@background = Sprite.new
@background.bitmap = Cache.system(WLTR::ALMANAC_SETUP::BACKGROUND)
end
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@help_window.opacity = 0 if WLTR::ALMANAC_SETUP::BACKGROUND != ""
@collection_list = Window_Item_Almanac_List.new(0, 56, 272, 360 - 48, @type)
@collection_list.viewport = @viewport
@collection_status = Window_Almanac_Item_Status.new(272, 56, 272, 360, @collection_list.item)
@collection_status.viewport = @viewport
@collection_list.help_window = @help_window
@percentage_window = Window_Base.new(0, 416 - 48, 272, 48)
@percentage_window.contents.draw_text(0, 0, 272, 20, sprintf(WLTR::ALMANAC_SETUP::PERCENTAGE_SHOW, $game_system.check_item_completition_rate(@type)))
@collection_list.active = true
@page = 1
end
def terminate
super
dispose_menu_background
@background.dispose if @background != nil
@help_window.dispose
@collection_list.dispose
@collection_status.dispose
@percentage_window.dispose
end
def return_scene
$scene = Scene_Menu.new
end
def update
super
update_menu_background
@help_window.update
@collection_list.update
@collection_status.update
@percentage_window.update
update_collection
end
def update_collection
if @collection_status.item != @collection_list.item
@collection_status.item = @collection_list.item
@collection_status.refresh(@page)
end
@collection_status.refresh(@page) if @page != @collection_status.page
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::RIGHT)
return if @page == 2 and !WLTR::ALMANAC_SETUP::GRAPHIC_USE
return if @page == 3
Audio.se_play("Audio/SE/" + WLTR::ALMANAC_SETUP::PAGE_FLIP_SE[0], WLTR::ALMANAC_SETUP::PAGE_FLIP_SE[1], WLTR::ALMANAC_SETUP::PAGE_FLIP_SE[2])
@page += 1
elsif Input.trigger?(Input::LEFT)
return if @page == 1
Audio.se_play("Audio/SE/" + WLTR::ALMANAC_SETUP::PAGE_FLIP_SE[0], WLTR::ALMANAC_SETUP::PAGE_FLIP_SE[1], WLTR::ALMANAC_SETUP::PAGE_FLIP_SE[2])
@page -= 1
end
end
end
#==============================================================================
# ¦ Window_Command
#==============================================================================
# Stole this from KGC...
class Window_Command < Window_Selectable
unless method_defined?(:add_command)
#--------------------------------------------------------------------------
# ? ???????
# ?????????
#--------------------------------------------------------------------------
def add_command(command)
@commands << command
@item_max = @commands.size
item_index = @item_max - 1
refresh_command
draw_item(item_index)
return item_index
end
#--------------------------------------------------------------------------
# ? ???????????
#--------------------------------------------------------------------------
def refresh_command
buf = self.contents.clone
self.height = [self.height, row_max * WLH + 32].max
create_contents
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def insert_command(index, command)
@commands.insert(index, command)
@item_max = @commands.size
refresh_command
refresh
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
@item_max = @commands.size
refresh
end
end
end
class Scene_Menu < Scene_Base
# Stole this from KGC's enemy guide.
if WLTR::ALMANAC_SETUP::ADD_TO_MENU
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
alias create_command_window_item_almanac create_command_window
def create_command_window
create_command_window_item_almanac
return if $imported["CustomMenuCommand"]
@__command_item_almanac =
@command_window.add_command(WLTR::ALMANAC_SETUP::ALMANAC_NAME)
if @command_window.oy > 0
@command_window.oy -= Window_Base::WLH
end
@command_window.index = @menu_index
end
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias update_command_selection_item_almanac update_command_selection
def update_command_selection
current_menu_index = @__command_item_almanac
call_item_almanac = false
if Input.trigger?(Input::C)
case @command_window.index
when @__command_item_almanac # ???????
call_enemy_guide_flag = true
end
end
# ??????????
if call_enemy_guide_flag
Sound.play_decision
$scene = Scene_Almanac.new(WLTR::ALMANAC_SETUP::ALMANAC_SHOW_MENU)
return
end
update_command_selection_item_almanac
end
end
#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================
Социальные закладки