[VXAce]Problem CSCA Encyclopedia

Hi all,

I use the script of Casper called "CSCA Encyclopedia" to have a bestiary in game. But I use also "Adjust limits" from Yanfly to break stats limits.

My problem is that the script of Casper don't read notetags that I use in the database to break stats limits.

Can you help me to fix it ?

Scripts are here :

Spoiler
=begin
CSCA Encyclopedia
version: 3.0.3 (Released: March 7, 2013)
Created by: Casper Gaming (http://www.caspergaming.com/)

Compatibility:
Made for RPGVXAce
IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
otherwise noted.
REQUIRES CSCA Core Script v1.0.5 or greater.
================================================================================
UPDATES:
version 1.1(April 14, 2012):
- Added ability to set enemy/item/etc. to discovered through script call.
- Bestiary MaxHP and MaxMP listed at top of parameters now instead of bottom.
- Ability to restrict which items, armors, weapons, and enemies are shown to
the player based on their ID(you can restrict which ID the list goes up to)

version 1.2(April 29, 2012):
- No more max items listed. If you want to leave an item/enemy/etc. unlisted now,
use the notetag .

version 2.0(June 17, 2012):
- Resized the windows to display more info on each item.
- Added skills and states to the encyclopedia.
- All commands(bestiary, items, etc.) are now able to be disabled.
- Changed colors of some text.
- Fixed bug with item occasion of Never.
- Made code more efficient.

version 2.0b(June 17, 2012)
- Removed add to menu option. Use the CSCA Menu Organizer for that instead.

version 2.1(July 12, 2012)
- Added option to use a custom image for skills/items/etc. instead of just using
the blown up icon for said skill/item/etc. Size of image is 72x72.
- Added ability to change x coordinate of stat amounts.
- Added ability to customize order encyclopedia lists are shown.

version 2.2(August 13, 2012)
- Windows now resize properly with different resolutions.

version 2.2b(September 5, 2012)
- Optimized script.
- Added ability to set amount of a certain enemy defeated.

version 2.2c(September 11, 2012)
- Param text now displays at the correct x coordinate automatically.

version 3.0(October 6, 2012)
- Divided the totals window into 2 separate windows, one shows total completion %,
the other shows category completion %.
- Added support for CSCA Achievement System.
- Users can now create their own custom categories.

version 3.0.1(October 14, 2012)
- Added ability to re-order custom categories and default categories.

version 3.0.2(October 21, 2012)
- Added ability to change descriptions of custom entries

version 3.0.3(March 7, 2013)
- Compatibility patch for CSCA Currency System
- Removed some duplicate code (now in Core Script)
================================================================================
FFEATURES:
This script creates an encyclopedia, with the option to insert it into the
default main menu. The encyclopedia contains a seperate list for items, armors,
weapons, and monsters(called bestiary).

BESTIARY: Shows enemy sprite(centered), name, currency gain, exp gain,
3 drop items, number of that enemy defeated, enemy parameters, location found,
and custom note.

ITEMS: Shows sprite (stretched bigger), item name, key item status, price,
HP Effect, MP Effect, TP Gain, success rate, occasion(menu/battle/none/both),
state applications and removals, number in possession, and custom note.

WEAPONS: Shows sprite (stretched bigger), weapon name, price, type, parameters,
speed bonus, state applications, attack element, number in possession, and
custom note.

ARMORS: Shows sprite (stretched bigger), armor name, slot, price, type,
parameters, state resists, and special effects(such as 2x gold), number in
possession, and custom note.

SKILLS: Shows sprite(stretched bigger), skill name, tp and mp cost, element,
damage type, state application and removal, scope, occasion, price(req. csca
skill shop), critical, variance, and custom note.

STATES: Shows sprite(stretched bigger), state name, priority, restriction,
removal types, chance of removal, max turns affected, min turns affected, and
custom note.

SETUP
This script requires setup further down.
Instructions included below.

IMPORTANT:
If using this script with an existing save file, you'll need to make the
following script call: $game_party.csca_init_encyclopedia

Note: If you are updating an existing version of this script, that script
call will revert everything back to undiscovered.

CREDIT:
Free to use in noncommercial games if credit is given to:
Casper Gaming (http://www.caspergaming.com/)

To use in a commercial game, please purchase a license here:
http://www.caspergaming.com/licenses.html

TERMS:
http://www.caspergaming.com/terms_of_use.html
=end
module CSCA_ENCYCLOPEDIA # Don't touch this.

####################
# NOTETAG COMMANDS #
####################
# If you have an item/whatever you don't want to be listed, put this notetag
# code in the item/whatever's notebox:
#
# To write a short note about anything, put this notetag code in the
# item/enemy/state/etc. notebox:
#
# To fill in an enemy's location info, put this notetag code in the enemy's
# notebox:
#
# To use a custom picture(size will be resized to 72x72 pixels) for the
# picture shown for an item/skill/weapon/armor/state, put this notetag in the
# item/skill/etc.'s notebox: (Do not include extension,
# .png is assumed. Other formats will not work.)
################
# SCRIPT CALLS #
################
# The following script calls allow you to set certain items to discovered.
#
# $game_party.csca_set_enemy_true(enemy_id)
# $game_party.csca_set_item_true(item_id)
# $game_party.csca_set_weapon_true(weapon_id)
# $game_party.csca_set_armor_true(armor_id)
# $game_party.csca_set_skill_true(skill_id)
# $game_party.csca_set_state_true(state_id)
# $game_party.csca_set_custom_true(custom_id)
#
#
# To change the amount of a certain enemy defeated, make script call:
#
# $game_party.csca_add_defeated(enemy_id,amount)
#
#
# To change descriptions for custom entries, use the following script call:
#
# $game_party.csca_change_desc(id, description)
# Where id is the ID of the description youw ant to change, and description is
# a new description array.
#===============================================================================
# Main Script Options

# This controls which commands will show, the order, and the text shown.
# DO NOT edit the first property(eg. :bestiary or :item).
COMMANDS = [ # Do not touch.
#[:symbol, "Text", enabled?] (don't change default category symbols)
[:bestiary, "Bestiary", true], # Re-order these any way you want.
[:town1, "NPC'S" , true], # Example for adding custom category
[:item, "Items" , true], # Re-order these any way you want.
[:weapon, "Weapons" , true], # Re-order these any way you want.
[:armor, "Armors" , true], # Re-order these any way you want.
[:story, "Story" , true], # Example for adding custom category
[:skill, "Skills" , true], # Re-order these any way you want.
[:state, "States" , true], # Re-order these any way you want.
] # Do not touch.

ACTOR_ONLY = true # True means states will only be discovered when an actor
# is inflicted with them. False means either actors or
# enemies being inflicted will discover a state.

TRIGGER = :C # Button used to toggle bestiary monster sprite and information.

MONSTER_OPACITY = 75 # Opacity of the monster sprite while toggled off.
# Range of valid numbers is 0 - 255, 0 being transparent.
#===============================================================================
# Vocab. The following are text that appear in the windows.

HEADER = "Encyclopedia" # Name window displayed at top during scene.

UNKNOWN = "? ? ? ? ?" # Text to be displayed if item/monster/etc. is undiscovered.

# Description for items/skills/weapons/armors/enemies not yet discovered.
UNKNOWN_DESCR = "This %s has not\nbeen discovered yet." # \n = new line

# Text shown instructing players how to toggle opacity of the monster sprites.
TRIGGER_TEXT = "Press Action button to toggle bestiary sprites."

# This text shows after skill scopes that target dead allies. The default term
# "Dead" may be too harsh for some games so this is changeable here.
DEAD_TEXT = "(Dead)"
#===============================================================================
# Colors. These numbers correspond to the index of the color squares in
# the windowskin.

GOOD_COLOR = 3 # Color for positive effects
BAD_COLOR = 2 # Color for negative effects
#===============================================================================
# Custom Category Settings - for advanced users only.
# With these options, you can create your own custom categories and define
# what each list contains, what each object displays, etc.

CUSTOM = [] # Do not touch.
KEYS = [] # Do not touch.
DESCRIPTION = [] # Do not touch.

# Description text shown in the information window of custom categories.
#DESCRIPTION[x] = [x,["Descriptive Text","Seperate lines with commas!"]]
# the first value before the text lines is the ID of the description.
# For example, DESCRIPTION[2838] = [2838,["text","here"]]
DESCRIPTION[0] = [0,["This citizen lives in","Example Town."]]
DESCRIPTION[1] = [1,["This citizen also lives","in Example Town"]]
DESCRIPTION[2] = [2,["This is the prologue of the game"]]

# KEYS[x] = [Name, image path, description array, key, id, custom text 1,
# custom text 2]
# image path is relative to the main project folder. Set to nil if not using.
# the key determines which custom category this object will be shown in, it
# MUST match one of the custom categories' keys.
# id is the ID of the array, KEYS[0] has id of 0, KEYS[1] has id of 1, etc.
# custom texts are short strings shown next to the image at the top, if not
# using set to ""
#
# Comment out or Delete these if not using!
KEYS[0] = ["Citizen 1","Graphics/Encyclopedia/Test.png",DESCRIPTION[0],
:town1,0,"Location: Test Town","Name: Citizen 1"]

KEYS[1] = ["Citizen 2","Graphics/Encyclopedia/Test.png",DESCRIPTION[1],
:town1,1,"Location: Test Town","Name: Citizen 2"]

KEYS[2] = ["Prologue",nil,DESCRIPTION[2],:story,2,"",""]

# CUSTOM[x] = [Category Name, key, text for unknown description]
# The key determines which KEYS will be shown in each category; their keys
# MUST match!
#
# Comment out or Delete these if not using!
CUSTOM[0] = ["NPC's",:town1,"NPC"]
CUSTOM[1] = ["Story",:story,"information"]
#===============================================================================
end # END SETUP #
$imported = {} if $imported.nil?
$imported["CSCA-Encyclopedia"] = true
msgbox('Missing Script: CSCA Core Script! CSCA Encyclopedia requires this
script to work properly.') if !$imported["CSCA-Core"]
class Scene_CSCA_Encyclopedia < Scene_MenuBase

def start
super
create_head_window
create_command_window
create_dummy_window
create_csca_info_window
create_specific_total_window
create_csca_list_window
create_total_window
end

def create_background
super
@background_sprite.tone.set(0, 0, 0, 128)
end

def create_command_window
@command_window = CSCA_Window_EncyclopediaMainSelect.new(0, @head_window.height)
@command_window.viewport = @viewport
@command_window.set_handler🙂ok, method🙂on_category_ok))
@command_window.set_handler🙂cancel, method🙂return_scene))
end

def create_head_window
@head_window = CSCA_Window_Header.new(0, 0, CSCA_ENCYCLOPEDIA::HEADER)
@head_window.viewport = @viewport
end

def create_dummy_window
wx = (Graphics.width / 2) - 40
wy = @command_window.y + @command_window.height
wh = Graphics.height - wy
@dummy_window = Window_Base.new(wx, wy, Graphics.width - wx, wh)
@dummy_window.viewport = @viewport
end

def create_specific_total_window
wy = @csca_info_window.height
wh = @head_window.height
wl = @dummy_window.width - 80
@specific_total_window = CSCA_Window_EncyclopediaSpecificTotal.new(0, wy, wl, wh)
@specific_total_window.viewport = @viewport
@command_window.csca_specific_total_window = @specific_total_window
end

def create_total_window
wy = @csca_list_window.y + @csca_list_window.height + @specific_total_window.height
wh = @head_window.height
wl = @csca_list_window.width
@total_window = CSCA_Window_EncyclopediaTotal.new(0, wy, wl, wh)
@total_window.viewport = @viewport
end

def create_csca_list_window
height = @dummy_window.height - (@command_window.height * 2)
width = @dummy_window.width - 80
wy = @dummy_window.y
@csca_list_window = CSCA_Window_ItemList.new(0, wy, width, height)
@csca_list_window.viewport = @viewport
@csca_list_window.help_window = @csca_info_window
@csca_list_window.set_handler🙂cancel, method🙂on_list_cancel))
@command_window.csca_list_window = @csca_list_window
end

def create_csca_info_window
wy = @command_window.y + @command_window.height
wh = Graphics.height - wy
@csca_info_window = CSCA_Window_EncyclopediaInfo.new(@dummy_window.x, wy, @dummy_window.width, wh)
@csca_info_window.viewport = @viewport
@csca_info_window.hide
end

def on_category_ok
@csca_list_window.activate
@csca_list_window.select(0)
@dummy_window.hide
@csca_info_window.show
end

def on_list_cancel
@csca_list_window.unselect
@command_window.activate
@csca_info_window.hide
@dummy_window.show
end

end
class CSCA_Window_EncyclopediaTotal < Window_Base

def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end

def refresh
contents.clear
draw_text(0,0,contents.width,line_height,sprintf("Total: %1.2f%% Complete",$game_party.csca_completion_percentage*100.00))
end
end
class CSCA_Window_EncyclopediaSpecificTotal < Window_Base

def initialize(x, y, width, height)
super(x, y, width, height)
@category = :none
end

def category=(category)
return if @category == category
@category = category
refresh
end

def refresh
contents.clear
case @category
when :bestiary
draw_text(0,0,contents.width,line_height,sprintf("%s: %1.2f%% Complete",
$game_party.csca_category_text🙂bestiary), $game_party.csca_completion_percentage_bestiary*100.00))
when :item
draw_text(0,0,contents.width,line_height,sprintf("%s: %1.2f%% Complete",
$game_party.csca_category_text🙂item), $game_party.csca_completion_percentage_items*100.00))
when :weapon
draw_text(0,0,contents.width,line_height,sprintf("%s: %1.2f%% Complete",
$game_party.csca_category_text🙂weapon), $game_party.csca_completion_percentage_weapons*100.00))
when :armor
draw_text(0,0,contents.width,line_height,sprintf("%s: %1.2f%% Complete",
$game_party.csca_category_text🙂armor), $game_party.csca_completion_percentage_armors*100.00))
when :skill
draw_text(0,0,contents.width,line_height,sprintf("%s: %1.2f%% Complete",
$game_party.csca_category_text🙂skill), $game_party.csca_completion_percentage_skills*100.00))
when :state
draw_text(0,0,contents.width,line_height,sprintf("%s: %1.2f%% Complete",
$game_party.csca_category_text🙂state), $game_party.csca_completion_percentage_states*100.00))
else
draw_text(0,0,contents.width,line_height,sprintf("%s: %1.2f%% Complete",
$game_party.csca_custom_text(@category), $game_party.csca_completion_percentage_cust(@category)*100.00))
end
end

end
class CSCA_Window_EncyclopediaInfo < Window_Base
def initialize(x, y, width, height)
super(x, y, width, height)
end

def set_text(text)
@text = text
draw_unknown_text
end

def clear
set_text("")
end

def set_item(item, sprite_in_front = 0)
contents.clear
contents.font.size = 24
if $game_party.encyclopedia_discovered(item)
if item.is_a?(RPG::Item)
draw_item_information(item)
elsif item.is_a?(RPG::Weapon)
draw_weapon_information(item)
elsif item.is_a?(RPG::Armor)
draw_armor_information(item)
elsif item.is_a?(RPG::State)
draw_state_information(item)
elsif item.is_a?(RPG::Skill)
draw_skill_information(item)
elsif item.is_a?(RPG::Enemy)
if sprite_in_front == 1
csca_draw_enemy_sprite(item)
csca_draw_toggle_tutorial
else
draw_enemy_information(item)
end
else
draw_custom_information(item) if !item.nil?
end
else
if item.is_a?(RPG::Item)
item_type = "item"
elsif item.is_a?(RPG::Weapon)
item_type = "weapon"
elsif item.is_a?(RPG::Armor)
item_type = "armor"
elsif item.is_a?(RPG::Enemy)
item_type = "enemy"
elsif item.is_a?(RPG::State)
item_type = "state"
elsif item.is_a?(RPG::Skill)
item_type = "skill"
else
if !item.nil?
for i in 0...CSCA_ENCYCLOPEDIA::CUSTOM.size
if CSCA_ENCYCLOPEDIA::CUSTOM[1] == item[3]
item_type = CSCA_ENCYCLOPEDIA::CUSTOM[2]
break
end
end
end
end
set_text(item ? sprintf(CSCA_ENCYCLOPEDIA::UNKNOWN_DESCR, item_type) : "")
end
end

def draw_unknown_text
draw_text_ex(4, 0, @text)
end

def draw_item_information(item)
csca_draw_icon(item)
csca_draw_name(item)
contents.font.size = 20
csca_draw_price(item)
item.key_item? ? key_item = "Yes" : key_item = "No"
draw_text(150,line_height,contents.width,line_height,key_item)
change_color(system_color)
draw_text(72,line_height,contents.width,line_height, "Key item:")
draw_text(0,line_height*3,contents.width,line_height,"HP Effect:")
draw_text(0,line_height*4-4,contents.width,line_height,"MP Effect:")
draw_text(0,line_height*5-8,contents.width,line_height,"TP gain:")
draw_text(0,line_height*6-12,contents.width,line_height,"Applies:")
draw_text(0,line_height*7-10,contents.width,line_height,"Removes:")
draw_text(0,line_height*8-10,contents.width,line_height,"Occasion:")
draw_text(0,line_height*9-14,contents.width,line_height,"Success Rate:")
change_color(normal_color)
occasion = ""
case item.occasion
when 0; occasion = "Always"
when 1; occasion = "Battle Only"
when 2; occasion = "Menu only"
when 3; occasion = "Never"
end
draw_text(78,line_height*8-10,contents.width,line_height,occasion)
draw_text(110,line_height*9-14,contents.width,line_height,item.success_rate.to_s + "%")
cscatpgain = 0
for effect in item.effects
next unless effect.code == 13
cscatpgain += (effect.value1 * 100).to_i
end
cscatpgain += item.tp_gain
cscatpgain = 100 if cscatpgain > 100
change_color(text_color(CSCA_ENCYCLOPEDIA::GOOD_COLOR)) if cscatpgain > 0
cscatpgain > 0 ? string = "+" : string = ""
draw_text(70,line_height*5-8,contents.width,line_height,sprintf(string +
"%d%%", cscatpgain))
change_color(normal_color)
csca_draw_value(11, 85,line_height*3, item) # 11 = HP
csca_draw_value(12, 85,line_height*4-4, item) # 12 = MP
csca_draw_states(0,item)
csca_draw_states(1,item)
csca_draw_possession(0,line_height*10-16,contents.width,line_height,item)
csca_draw_custom_note(0,line_height*11-20,contents.width,line_height,item)
end

def draw_weapon_information(item)
csca_draw_icon(item)
csca_draw_name(item)
contents.font.size = 20
csca_draw_type(item,120,line_height,contents.width-120,line_height)
csca_draw_price(item)
csca_draw_all_params(item)
change_color(system_color)
draw_text(72,line_height,contents.width,line_height,"Type:")
draw_text(0,line_height*7-16,contents.width,line_height,"Element:")
draw_text(0,line_height*8-20,contents.width,line_height,"Speed:")
draw_text(0,line_height*9-20,contents.width,line_height,"Applies:")
change_color(normal_color)
csca_draw_type(item,70,line_height*7-16,contents.width-70,line_height,1)
csca_draw_wpn_speed(item)
csca_draw_states(3,item)
csca_draw_possession(0,line_height*10-16,contents.width,line_height,item)
csca_draw_custom_note(0,line_height*11-20,contents.width,line_height,item)
end

def draw_armor_information(item)
csca_draw_icon(item)
csca_draw_name(item)
contents.font.size = 20
csca_draw_price(item)
case item.etype_id
when 1; type = "Shield"
when 2; type = "Head"
when 3; type = "Body"
when 4; type = "Accessory"
end
draw_text(165,line_height,contents.width,line_height,type)
csca_draw_all_params(item)
change_color(system_color)
draw_text(72,line_height,contents.width,line_height,"Armor Slot:")
draw_text(0,line_height*7-12,contents.width,line_height,"Resists:")
draw_text(0,line_height*8-12,contents.width,line_height,"Armor Type:")
draw_text(0,line_height*9-16,contents.width,line_height,"Special:")
change_color(normal_color)
csca_draw_states(2,item)
csca_draw_type(item,95,line_height*8-12,contents.width-100,line_height)
string = "None"
for feature in item.features
string = feature.data_id if feature.code == 64
end
case string
when 0; string = "50% Encounter Rate"
when 1; string = "0% Encounter Rate"
when 2; string = "0% Surprise Rate"
when 3; string = "Raise Preemptive Rate"
when 4; string = "200% Gold Drop Rate"
when 5; string = "200% Item Drop Rate"
end
draw_text(70,line_height*9-16,contents.width,line_height,string)
csca_draw_possession(0,line_height*10-16,contents.width,line_height,item)
csca_draw_custom_note(0,line_height*11-20,contents.width,line_height,item)
end

def draw_state_information(item)
csca_draw_icon(item)
csca_draw_name(item)
contents.font.size = 20
change_color(system_color)
draw_text(72,line_height,contents.width,line_height,"Restriction:")
draw_text(72,line_height*2-4,contents.width,line_height,"Priority:")
draw_text(0,line_height*3,contents.width,line_height,"Minimum Turns:")
draw_text(0,line_height*4-4,contents.width,line_height,"Maximum Turns:")
draw_text(0,line_height*5-8,contents.width,line_height,"Remove After Battle:")
draw_text(0,line_height*6-12,contents.width,line_height,"Remove By Restriction:")
draw_text(0,line_height*7-16,contents.width,line_height,"Remove By Damage:")
draw_text(0,line_height*8-20,contents.width,line_height,"Chance On Damage:")
draw_text(0,line_height*8,contents.width,line_height,"Remove By Walking:")
draw_text(0,line_height*9-4,contents.width,line_height,"Steps To Remove:")
change_color(normal_color)
restriction_string = item.restriction
case restriction_string
when 0; restriction_string = "None"
when 1; restriction_string = "Attack Enemies"
when 2; restriction_string = "Attack Anyone"
when 3; restriction_string = "Attack Allies"
when 4; restriction_string = "Can't Move"
end
if item.auto_removal_timing != 1 && item.auto_removal_timing != 2
max_turn = "N/A"
min_turn = "N/A"
else
max_turn = item.max_turns.to_s
min_turn = item.min_turns.to_s
end
item.remove_at_battle_end ? b_remove = "Yes" : b_remove = "No"
item.remove_by_restriction ? r_remove = "Yes" : r_remove = "No"
if item.remove_by_damage
d_remove = "Yes"
d_chance = item.chance_by_damage.to_s + "%"
else
d_remove = "No"
d_chance = "N/A"
end
if item.remove_by_walking
w_remove = "Yes"
w_steps = item.steps_to_remove.to_s
else
w_remove = "No"
w_steps = "N/A"
end
draw_text(170,line_height,contents.width,line_height,restriction_string)
draw_text(147,line_height*2-4,contents.width,line_height,item.priority.to_s)
draw_text(115,line_height*3,contents.width,line_height,min_turn)
draw_text(115,line_height*4-4,contents.width,line_height,max_turn)
draw_text(165,line_height*5-8,contents.width,line_height,b_remove)
draw_text(180,line_height*6-12,contents.width,line_height,r_remove)
draw_text(140,line_height*7-16,contents.width,line_height,d_remove)
draw_text(140,line_height*8-20,contents.width,line_height,d_chance)
draw_text(150,line_height*8,contents.width,line_height,w_remove)
draw_text(135,line_height*9-4,contents.width,line_height,w_steps)
csca_draw_custom_note(0,line_height*11-12,contents.width,line_height,item)
end

def draw_skill_information(item)
csca_draw_icon(item)
csca_draw_name(item)
contents.font.size = 20
change_color(system_color)
draw_text(0,line_height*9-16,contents.width,line_height,"Element:")
draw_text(72,line_height,contents.width,line_height,"MP Cost:")
draw_text(72,line_height*2-4,contents.width,line_height,"TP Cost:")
draw_text(0,line_height*3-4,contents.width,line_height,"Type:")
draw_text(0,line_height*4-8,contents.width,line_height,"Damage:")
draw_text(0,line_height*5-12,contents.width,line_height,"Critical:")
draw_text(0,line_height*6-12,contents.width,line_height,"Applies:")
draw_text(0,line_height*7-12,contents.width,line_height,"Removes:")
draw_text(0,line_height*8-12,contents.width,line_height,"Variance:")
draw_text(0,line_height*10-20,contents.width,line_height,"Scope:")
$imported["CSCA-SkillShop"] ?
draw_text(0,line_height*10,contents.width,line_height,"Price:") :
draw_text(0,line_height*10,contents.width,line_height,"Occasion:")
change_color(normal_color)
damage_string = item.damage.type
scope_string = item.scope
occasion_string = item.occasion
case damage_string
when 0; damage_string = "None"
when 1; damage_string = "HP Damage"
when 2; damage_string = "MP Damage"
when 3; damage_string = "HP Recovery"
when 4; damage_string = "MP Recovery"
when 5; damage_string = "HP Drain"
when 6; damage_string = "MP Drain"
end
case scope_string
when 0; scope_string = "None"
when 1; scope_string = "One Enemy"
when 2; scope_string = "All Enemies"
when 3; scope_string = "One Random Enemy"
when 4; scope_string = "Two Random Enemies"
when 5; scope_string = "Three Random Enemies"
when 6; scope_string = "Four Random Enemies"
when 7; scope_string = "One Ally"
when 8; scope_string = "All Allies"
when 9; scope_string = "One Ally " + CSCA_ENCYCLOPEDIA:😀EAD_TEXT
when 10; scope_string = "All Allies " + CSCA_ENCYCLOPEDIA:😀EAD_TEXT
when 11; scope_string = "The user"
end
case occasion_string
when 0; occasion_string = "Always"
when 1; occasion_string = "Battle Only"
when 2; occasion_string = "Menu only"
when 3; occasion_string = "Never"
end
item.damage.critical ? critical = "Yes" : critical = "No"
draw_text(140,line_height,contents.width,line_height,item.mp_cost.to_s)
draw_text(140,line_height*2-4,contents.width,line_height,item.tp_cost.to_s)
csca_draw_type(item,47,line_height*3-4,contents.width-70,line_height)
csca_draw_type(item,70,line_height*9-16,contents.width-70,line_height,1)
draw_text(65,line_height*4-8,contents.width,line_height,damage_string)
draw_text(75,line_height*5-12,contents.width,line_height,critical)
draw_text(75,line_height*8-12,contents.width,line_height,item.damage.variance.to_s + "%")
csca_draw_states(0,item)
csca_draw_states(1,item)
draw_text(55,line_height*10-20,contents.width,line_height,scope_string)
$imported["CSCA-SkillShop"] ?
draw_text(55,line_height*10,contents.width,line_height,item.skill_price.to_s + Vocab::currency_unit) :
draw_text(78,line_height*10,contents.width,line_height,occasion_string)
csca_draw_custom_note(0,line_height*11-4,contents.width,line_height,item)
end

def draw_enemy_information(item)
csca_draw_enemy_sprite(item, CSCA_ENCYCLOPEDIA::MONSTER_OPACITY)
csca_draw_name(item, 1)
contents.font.size = 20
csca_draw_enemy_rewards(item, 0, line_height)
csca_draw_enemy_rewards(item, 1, line_height*2-4)
csca_draw_all_params(item, 1)
draw_text(88,line_height*6,contents.width,line_height,"1.")
draw_text(88,line_height*7-4,contents.width,line_height,"2.")
draw_text(88,line_height*8-8,contents.width,line_height,"3.")
csca_draw_enemy_treasures(item)
change_color(system_color)
draw_text(0,line_height*6,contents.width,line_height,"Treasures:")
draw_text(0,line_height*9-12,contents.width,line_height,"Number Defeated:")
draw_text(0,line_height*10-16,contents.width,line_height,"Found:")
change_color(normal_color)
string = $game_party.csca_enemies_defeated(item).to_s
draw_text(130,line_height*9-12,contents.width,line_height," "+string)
draw_text(45,line_height*10-16,contents.width,line_height," "+item.csca_locations)
csca_draw_custom_note(0,line_height*11-20,contents.width,line_height,item)
csca_draw_toggle_tutorial
end

def draw_custom_information(item)
item[1].nil? ? x = 0 : x = 72
contents.font.bold = true
draw_text(x,0,contents.width-72,line_height,item[0])
contents.font.bold = false
unless item[1].nil?
bitmap = Bitmap.new(item[1])
target = Rect.new(0,0,72,72)
contents.stretch_blt(target, bitmap, bitmap.rect, 255)
end
contents.font.size = 20
y = line_height
draw_text(x,y,contents.width-72,line_height,item[5])
item[5] != "" ? y += line_height : y += 0
draw_text(x,y,contents.width-72,line_height,item[6])
item[6] != "" ? y += line_height-4 : y += 0
description = $game_party.csca_descriptions[item[2][0]]
for i in 0...description[1].size
draw_text(0,y,contents.width,line_height,description[1])
y += line_height-4
end
end

def csca_draw_possession(x,y,width,height,item)
change_color(system_color)
draw_text(x,y,width,height,"Possession:")
change_color(normal_color)
draw_text(x+95,y,width,height,$game_party.item_number(item).to_s)
end

def csca_draw_custom_note(x,y,width,height,item)
change_color(system_color)
draw_text(x,y,width,height,"Note:")
change_color(normal_color)
draw_text(x+40,y,width,height," "+item.csca_custom_note)
end

def csca_draw_toggle_tutorial
contents.font.size = 16
draw_text(0,line_height*12-12,contents.width,line_height,CSCA_ENCYCLOPEDIA::TRIGGER_TEXT,1)
end

def csca_draw_enemy_sprite(item, opacity = 255)
bitmap = Cache.battler(item.battler_name, item.battler_hue)
x = (contents.width / 2) - (bitmap.width / 2)
y = (contents.height / 2) - (bitmap.height / 2)
if bitmap.width > contents.width && bitmap.height > contents.height
target = Rect.new(0, 0, contents.width, contents.height)
elsif bitmap.width > contents.width
target = Rect.new(0, y, contents.width, bitmap.height)
elsif bitmap.height > contents.height
target = Rect.new(x, 0, bitmap.width, contents.height)
else
target = Rect.new(x,y,bitmap.width,bitmap.height)
end
contents.stretch_blt(target, bitmap, bitmap.rect, opacity)
end

def csca_draw_enemy_treasures(enemy)
drop1 = "Nothing"
drop2 = "Nothing"
drop3 = "Nothing"
items = []
for item in enemy.drop_items
if items[0].nil?
items[0] = item
next
end
if items[1].nil?
items[1] = item
next
end
items[2] = item
end
case items[0].kind
when 1; drop1 = $data_items[items[0].data_id].name
when 2; drop1 = $data_weapons[items[0].data_id].name
when 3; drop1 = $data_armors[items[0].data_id].name
end
case items[1].kind
when 1; drop2 = $data_items[items[1].data_id].name
when 2; drop2 = $data_weapons[items[1].data_id].name
when 3; drop2 = $data_armors[items[1].data_id].name
end
case items[2].kind
when 1; drop3 = $data_items[items[2].data_id].name
when 2; drop3 = $data_weapons[items[2].data_id].name
when 3; drop3 = $data_armors[items[2].data_id].name
end
draw_text(105,line_height*6,contents.width-96,line_height,drop1)
draw_text(105,line_height*7-4,contents.width-96,line_height,drop2)
draw_text(105,line_height*8-8,contents.width-96,line_height,drop3)
end

def csca_draw_enemy_rewards(item, type, y)
if type == 0
currency = $game_party.get_csca_cs_currency(item.currency_symbol) if $imported["CSCA-CurrencySystem"]
reward = item.gold
string1 = "Currency: "
string2 = $imported["CSCA-CurrencySystem"] ? currency[:currency_unit] : Vocab::currency_unit
x = 78
else
reward = item.exp
string1 = "Experience: "
string2 = ""
x = 95
end
change_color(system_color)
draw_text(0,y,contents.width,line_height,string1)
change_color(type == 0 && $imported["CSCA-CurrencySystem"] ? currency[:color] : normal_color)
number = $csca.split_number(reward)
if number[0] >= 1
draw_text(x,y,contents.width,line_height,sprintf("%d,%03d,%03d"+string2,number[0],number[1],number[2]))
elsif number[0] == 0 && number[1] >= 1
draw_text(x,y,contents.width,line_height,sprintf("%d,%03d"+string2,number[1],number[2]))
else
draw_text(x,y,contents.width,line_height,sprintf("%d"+string2,number[2]))
end
change_color(normal_color)
end

def csca_draw_icon(item)
if item.csca_custom_picture == ""
icon_index = item.icon_index
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
target = Rect.new(0,0,72,72)
contents.stretch_blt(target, bitmap, rect)
else
bitmap = Bitmap.new("Graphics/Pictures/"+item.csca_custom_picture+".png")
target = Rect.new(0,0,72,72)
contents.stretch_blt(target, bitmap, bitmap.rect, 255)
end
end

def csca_draw_name(item, center = 0)
contents.font.bold = true
center != 0 ? draw_text(0,0,contents.width,line_height,item.name,center) :
draw_text(72,0,contents.width-72,line_height,item.name)
contents.font.bold = false
end

def csca_draw_price(item)
number = $csca.split_number(item.price)
currency = $game_party.get_csca_cs_currency(item.currency_symbol) if $imported["CSCA-CurrencySystem"]
unit = $imported["CSCA-CurrencySystem"] ? currency[:currency_unit] : Vocab::currency_unit
change_color(system_color)
draw_text(72,line_height*2-4,contents.width,line_height,"Price:")
change_color(item.price > 0 && $imported["CSCA-CurrencySystem"] ? currency[:color] : normal_color)
if number[0] >= 1
draw_text(125,line_height*2-4,contents.width,line_height,sprintf("%d,%03d,%03d" + unit, number[0], number[1], number[2]))
elsif number[0] == 0 && number[1] >= 1
draw_text(125,line_height*2-4,contents.width,line_height,sprintf("%d,%03d" + unit, number[1], number[2]))
elsif number[0] == 0 && number[1] == 0 && number[2] >= 1
draw_text(125,line_height*2-4,contents.width,line_height,sprintf("%d" + unit, number[2]))
else
draw_text(125,line_height*2-4,contents.width,line_height,"N/A")
end
change_color(normal_color)
end

def csca_draw_all_params(item, type = 0)
w = contents.width/2
if type == 0
y1 = line_height*3
y2 = line_height*4-4
y3 = line_height*5-8
y4 = line_height*6-12
else
y4 = line_height*3-8
y1 = line_height*4-12
y2 = line_height*5-16
y3 = line_height*6-20
end
change_color(system_color)
param_0 = Vocab:😛aram(0)+": "
param_1 = Vocab:😛aram(1)+": "
param_2 = Vocab:😛aram(2)+": "
param_3 = Vocab:😛aram(3)+": "
param_4 = Vocab:😛aram(4)+": "
param_5 = Vocab:😛aram(5)+": "
param_6 = Vocab:😛aram(6)+": "
param_7 = Vocab:😛aram(7)+": "
draw_text(0,y1,contents.width,line_height,param_2)
draw_text(w,y1,contents.width,line_height,param_3)
draw_text(0,y2,contents.width,line_height,param_4)
draw_text(w,y2,contents.width,line_height,param_5)
draw_text(0,y3,contents.width,line_height,param_6)
draw_text(w,y3,contents.width,line_height,param_7)
draw_text(0,y4,contents.width,line_height,param_0)
draw_text(w,y4,contents.width,line_height,param_1)
change_color(normal_color)
csca_draw_param(2,item,text_size(param_2).width,y1)
csca_draw_param(3,item,w+text_size(param_3).width,y1)
csca_draw_param(4,item,text_size(param_4).width,y2)
csca_draw_param(5,item,w+text_size(param_5).width,y2)
csca_draw_param(6,item,text_size(param_6).width,y3)
csca_draw_param(7,item,w+text_size(param_7).width,y3)
csca_draw_param(0,item,text_size(param_0).width,y4)
csca_draw_param(1,item,w+text_size(param_1).width,y4)
end

def csca_draw_param(param_id, item, x, y)
parameter = item.params[param_id]
string = ""
if parameter > 0
unless item.is_a?(RPG::Enemy)
change_color(text_color(CSCA_ENCYCLOPEDIA::GOOD_COLOR))
string = "+"
end
elsif parameter < 0
change_color(text_color(CSCA_ENCYCLOPEDIA::BAD_COLOR))
string = ""
else
change_color(normal_color)
string = ""
end
string += parameter.to_s
draw_text(x,y,contents.width,line_height,string)
change_color(normal_color)
end

def csca_draw_type(item,x,y,w,h,elm = 0)
if item.is_a?(RPG::Armor)
csca_array = $data_system.armor_types
item.atype_id == 0 ? string = "None" : string = csca_array[item.atype_id]
elsif item.is_a?(RPG::Weapon)
case elm
when 0
csca_array = $data_system.weapon_types
item.wtype_id == 0 ? string = "None" : string = csca_array[item.wtype_id]
when 1
csca_array = $data_system.elements
string = "None"
for feature in item.features
case feature.code
when 31
feature.data_id == 0 ? string = "None" : string = csca_array[feature.data_id]
end
end
end
elsif item.is_a?(RPG::Skill)
case elm
when 0
csca_array = $data_system.skill_types
item.stype_id == 0 ? string = "None" : string = csca_array[item.stype_id]
when 1
csca_array = $data_system.elements
item.damage.element_id < 0 ? string = "Normal Attack" :
item.damage.element_id == 0 ? string = "None" : string = csca_array[item.damage.element_id]
end
end
draw_text(x,y,w,h,string)
end

def csca_draw_wpn_speed(item)
speed = 0
for feature in item.features
case feature.code
when 33
speed += feature.value.to_i
end
end
if speed > 0
change_color(text_color(CSCA_ENCYCLOPEDIA::GOOD_COLOR))
string = "+"
elsif speed < 0
change_color(text_color(CSCA_ENCYCLOPEDIA::BAD_COLOR))
string = ""
else
change_color(normal_color)
string = ""
end
draw_text(50,line_height*8-20,contents.width,line_height,string + speed.to_s)
change_color(normal_color)
end

def csca_draw_value(code,x,y,item)
p = 0
c = 0
string = ""
for effect in item.effects
next unless effect.code == code
p = (effect.value1 * 100).to_i
c += effect.value2.to_i
end
c *= item.repeats
if c != 0
if c > 0
change_color(text_color(CSCA_ENCYCLOPEDIA::GOOD_COLOR))
string = "+"
else
change_color(text_color(CSCA_ENCYCLOPEDIA::BAD_COLOR))
string = ""
end
draw_text(x,y,contents.width,line_height,sprintf(string+"%d", c))
elsif p != 0
if p > 0
change_color(text_color(CSCA_ENCYCLOPEDIA::GOOD_COLOR))
string = "+"
else
change_color(text_color(CSCA_ENCYCLOPEDIA::BAD_COLOR))
string = ""
end
draw_text(x,y,contents.width,line_height,sprintf(string+"%d%%", p))
else
draw_text(x,y,contents.width,line_height,"0")
end
change_color(normal_color)
end

def csca_draw_states(applies,item)
icons = []
if item.is_a?(RPG::Item) || item.is_a?(RPG::Skill)
for effect in item.effects
if applies == 0
case effect.code
when 21
next unless effect.value1 > 0
next if $data_states[effect.value1].nil?
next if effect.data_id == 0
icons.push($data_states[effect.data_id].icon_index)
end
icons.delete(0)
break if icons.size >= 9
else
case effect.code
when 22
next unless effect.value1 > 0
next if $data_states[effect.value1].nil?
next if effect.data_id == 0
icons.push($data_states[effect.data_id].icon_index)
end
icons.delete(0)
break if icons.size >= 9
end
end
elsif item.is_a?(RPG::Armor)
for feature in item.features
icons.push($data_states[feature.data_id].icon_index) if feature.code == 14
icons.delete(0)
break if icons.size >= 9
end
else
for feature in item.features
icons.push($data_states[feature.data_id].icon_index) if feature.code == 32
icons.delete(0)
break if icons.size >= 9
end
end
case applies
when 0; y = line_height*6-12
when 1; y = line_height*7-10
when 2; y = line_height*7-12
when 3; y = line_height*9-20
end
csca_draw_icons(70, y, contents.width, icons)
end

def csca_draw_icons(x, y, width, icons)
for icon_id in icons
draw_icon(icon_id, x, y)
x += 24
end
if icons.size == 0
draw_text(70,y,contents.width,line_height,"Nothing")
end
end

end
class CSCA_Window_EncyclopediaMainSelect < Window_HorzCommand
attr_reader :csca_list_window
attr_reader :csca_specific_total_window

def initialize(x, y)
super(x,y)
end

def update
super
@csca_list_window.category = current_symbol if @csca_list_window
@csca_specific_total_window.category = current_symbol if @csca_specific_total_window
end

def make_command_list
for i in 0...CSCA_ENCYCLOPEDIA::COMMANDS.size
if CSCA_ENCYCLOPEDIA::COMMANDS[2]
add_command(CSCA_ENCYCLOPEDIA::COMMANDS[1],CSCA_ENCYCLOPEDIA::COMMANDS[0])
end
end
end

def csca_list_window=(csca_list_window)
@csca_list_window = csca_list_window
update
end

def csca_specific_total_window=(csca_specific_total_window)
@csca_specific_total_window = csca_specific_total_window
update
end

def window_width
return Graphics.width
end

end
class CSCA_Window_ItemList < Window_Selectable

def initialize(x, y, width, height)
super
@category = :none
@data = []
@csca_monster_in_front = false
end

def category=(category)
return if @category == category
@category = category
refresh
self.oy = 0
end

def item_max
@data ? @data.size : 1
end

def item
@data && index >= 0 ? @data[index] : nil
end

def include?(item)
case @category
when :bestiary
item.is_a?(RPG::Enemy) && !item.csca_encyclopedia_exclude?
when :item
item.is_a?(RPG::Item) && !item.csca_encyclopedia_exclude?
when :weapon
item.is_a?(RPG::Weapon) && !item.csca_encyclopedia_exclude?
when :armor
item.is_a?(RPG::Armor) && !item.csca_encyclopedia_exclude?
when :state
item.is_a?(RPG::State) && !item.csca_encyclopedia_exclude?
when :skill
item.is_a?(RPG::Skill) && !item.csca_encyclopedia_exclude?
else
false
end
end

def cust_include?(item)
item[3] == @category
end

def make_item_list
@data = $data_items.select {|item| include?(item)}
@data += $data_weapons.select {|item| include?(item)}
@data += $data_armors.select {|item| include?(item)}
@data += $data_enemies.select {|item| include?(item)}
@data += $data_skills.select {|item| include?(item)}
@data += $data_states.select {|item| include?(item)}
@data += CSCA_ENCYCLOPEDIA::KEYS.select {|item| cust_include?(item)}
@data.push(nil) if include?(nil)
end

def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
draw_item_id(rect, index)
if $game_party.encyclopedia_discovered(item)
if item.is_a?(RPG::Enemy)
draw_text(rect.x+40,rect.y,contents.width-40,line_height,item.name)
elsif not_custom(item)
draw_item_name(item, rect.x + 40, rect.y, true, contents.width - 60)
else
draw_text(rect.x+40,rect.y,contents.width-40,line_height,item[0])
end
else
draw_unknown_text(rect)
end
end
end

def draw_item_id(rect, index)
draw_text(rect, sprintf("%3d.", index + 1))
end

def draw_unknown_text(rect)
draw_text(rect, sprintf(" %s", CSCA_ENCYCLOPEDIA::UNKNOWN))
end

def not_custom(item)
item.is_a?(RPG::Item) || item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor) ||
item.is_a?(RPG::Skill) || item.is_a?(RPG::State) || item.is_a?(RPG::Enemy)
end

def update_help
if @category == :bestiary && @csca_monster_in_front == true
@help_window.set_item(item, 1)
else
@help_window.set_item(item, 0)
end
end

def refresh
refresh_button_input
make_item_list
create_contents
draw_all_items
end

def update
super
refresh_button_input
end

def refresh_button_input
if Input.trigger?(CSCA_ENCYCLOPEDIA::TRIGGER) && @csca_monster_in_front && @category == :bestiary
@csca_monster_in_front = false
Sound.play_ok
update_help
elsif Input.trigger?(CSCA_ENCYCLOPEDIA::TRIGGER) && !@csca_monster_in_front && @category == :bestiary
@csca_monster_in_front = true
Sound.play_ok
update_help
end
end

end
class Game_Party < Game_Unit
attr_reader :csca_enemies
attr_reader :csca_items
attr_reader :csca_weapons
attr_reader :csca_armors
attr_reader :csca_defeated_number
attr_reader :csca_states
attr_reader :csca_skills
attr_reader :csca_custom_enc
attr_reader :csca_descriptions

alias csca_init_all_items init_all_items
def init_all_items
csca_init_all_items
csca_init_encyclopedia
end

def csca_init_encyclopedia
@csca_enemies = []
@csca_items = []
@csca_weapons = []
@csca_armors = []
@csca_defeated_number = []
@csca_states = []
@csca_skills = []
@csca_custom_enc = []
@csca_descriptions = []
@enemy_number = 0
for i in 0..$data_enemies.size
@csca_enemies = false
@csca_defeated_number = 0
end
for i in 0..$data_items.size
@csca_items = false
end
for i in 0..$data_weapons.size
@csca_weapons = false
end
for i in 0..$data_armors.size
@csca_armors = false
end
for i in 0..$data_skills.size
@csca_skills = false
end
for i in 0..$data_states.size
@csca_states = false
end
for i in 0...CSCA_ENCYCLOPEDIA::KEYS.size
@csca_custom_enc = false
end
for i in 0...CSCA_ENCYCLOPEDIA:😀ESCRIPTION.size
@csca_descriptions = CSCA_ENCYCLOPEDIA:😀ESCRIPTION
end
end

alias csca_gain_item gain_item
def gain_item(item, amount, include_equip = false)
csca_gain_item(item, amount)
csca_set_discovered(item)
end

def csca_change_desc(id, description)
@csca_descriptions[id] = [id,description]
end

def csca_set_discovered(item, discover = true)
if item.is_a?(RPG::Item)
@csca_items[item.id] = discover
elsif item.is_a?(RPG::Weapon)
@csca_weapons[item.id] = discover
elsif item.is_a?(RPG::Armor)
@csca_armors[item.id] = discover
elsif item.is_a?(RPG::Enemy)
@csca_enemies[item.id] = discover
elsif item.is_a?(RPG::Skill)
@csca_skills[item.id] = discover
elsif item.is_a?(RPG::State)
@csca_states[item.id] = discover
elsif !item.nil?
@csca_custom_enc[item] = discover
end
end

def csca_set_defeated(enemy, number = 1)
@csca_defeated_number[enemy.id] += number
end

def csca_enemies_defeated(enemy)
@csca_defeated_number[enemy.id]
end

def encyclopedia_discovered(item)
if item.is_a?(RPG::Item)
@csca_items[item.id]
elsif item.is_a?(RPG::Weapon)
@csca_weapons[item.id]
elsif item.is_a?(RPG::Armor)
@csca_armors[item.id]
elsif item.is_a?(RPG::Enemy)
@csca_enemies[item.id]
elsif item.is_a?(RPG::Skill)
@csca_skills[item.id]
elsif item.is_a?(RPG::State)
@csca_states[item.id]
else
unless item.nil?
@csca_custom_enc[item[4]]
end
end
end

def enemies_discovered
number = 0
for i in 0..@csca_enemies.size
if @csca_enemies == true && !$data_enemies.csca_encyclopedia_exclude?
number += 1
end
end
return number
end

def items_discovered
number = 0
for i in 0..@csca_items.size
if @csca_items == true && !$data_items.csca_encyclopedia_exclude?
number += 1
end
end
return number
end

def weapons_discovered
number = 0
for i in 0..@csca_weapons.size
if @csca_weapons == true && !$data_weapons.csca_encyclopedia_exclude?
number += 1
end
end
return number
end

def armors_discovered
number = 0
for i in 0..@csca_armors.size
if @csca_armors == true && !$data_armors.csca_encyclopedia_exclude?
number += 1
end
end
return number
end

def states_discovered
number = 0
for i in 0..@csca_states.size
if @csca_states == true && !$data_states.csca_encyclopedia_exclude?
number += 1
end
end
return number
end

def skills_discovered
number = 0
for i in 0..@csca_skills.size
if @csca_skills == true && !$data_skills.csca_encyclopedia_exclude?
number += 1
end
end
return number
end

def custom_enc_discovered(symbol)
number = 0
for i in 0..@csca_custom_enc.size
if @csca_custom_enc == true && CSCA_ENCYCLOPEDIA::KEYS[3] == symbol
number += 1
end
end
return number
end

def csca_set_enemy_true(enemy_id)
csca_set_discovered($data_enemies[enemy_id])
end

def csca_set_item_true(item_id)
csca_set_discovered($data_items[item_id])
end

def csca_set_armor_true(armor_id)
csca_set_discovered($data_armors[armor_id])
end

def csca_set_weapon_true(weapon_id)
csca_set_discovered($data_weapons[weapon_id])
end

def csca_set_state_true(state_id)
csca_set_discovered($data_states[state_id])
end

def csca_set_skill_true(skill_id)
csca_set_discovered($data_skills[skill_id])
end

def csca_set_custom_true(custom_id)
csca_set_discovered(custom_id)
end

def csca_add_defeated(enemy_id,amount)
csca_set_defeated($data_enemies[enemy_id],amount)
end

def csca_total_enemies
total = 0
for i in 0..$data_enemies.size
if $data_enemies.is_a?(RPG::Enemy)
total += 1 if !$data_enemies.csca_encyclopedia_exclude?
end
end
return total
end

def csca_total_items
total = 0
for i in 0..$data_items.size
if $data_items.is_a?(RPG::Item)
total += 1 if !$data_items.csca_encyclopedia_exclude?
end
end
return total
end

def csca_total_weapons
total = 0
for i in 0..$data_weapons.size
if $data_weapons.is_a?(RPG::Weapon)
total += 1 if !$data_weapons.csca_encyclopedia_exclude?
end
end
return total
end

def csca_total_armors
total = 0
for i in 0..$data_armors.size
if $data_armors.is_a?(RPG::Armor)
total += 1 if !$data_armors.csca_encyclopedia_exclude?
end
end
return total
end

def csca_total_skills
total = 0
for i in 0..$data_skills.size
if $data_skills.is_a?(RPG::Skill)
total += 1 if !$data_skills.csca_encyclopedia_exclude?
end
end
return total
end

def csca_total_states
total = 0
for i in 0..$data_states.size
if $data_states.is_a?(RPG::State)
total += 1 if !$data_states.csca_encyclopedia_exclude?
end
end
return total
end

def csca_total_custom_enc(symbol)
total = 0
for i in 0...CSCA_ENCYCLOPEDIA::KEYS.size
total += 1 if CSCA_ENCYCLOPEDIA::KEYS[3] == symbol
end
return total
end

def csca_completion_percentage_bestiary
csca_total_enemies == 0 ? 0 : (enemies_discovered.to_f/csca_total_enemies)
end

def csca_completion_percentage_items
csca_total_items == 0 ? 0 : (items_discovered.to_f/csca_total_items)
end

def csca_completion_percentage_weapons
csca_total_weapons == 0 ? 0 : (weapons_discovered.to_f/csca_total_weapons)
end

def csca_completion_percentage_armors
csca_total_armors == 0 ? 0 : (armors_discovered.to_f/csca_total_armors)
end

def csca_completion_percentage_skills
csca_total_skills == 0 ? 0 : (skills_discovered.to_f/csca_total_skills)
end

def csca_completion_percentage_states
csca_total_states == 0 ? 0 : (states_discovered.to_f/csca_total_states)
end

def csca_completion_percentage_cust(symbol)
total = csca_total_custom_enc(symbol)
total == 0 ? 0 : (custom_enc_discovered(symbol).to_f/total)
end


def csca_completion_percentage
total = 0
total += csca_total_enemies if csca_command_enabled?🙂bestiary)
total += csca_total_items if csca_command_enabled?🙂item)
total += csca_total_weapons if csca_command_enabled?🙂weapon)
total += csca_total_armors if csca_command_enabled?🙂armor)
total += csca_total_skills if csca_command_enabled?🙂skill)
total += csca_total_states if csca_command_enabled?🙂state)
total += CSCA_ENCYCLOPEDIA::KEYS.size
disc = 0
disc += enemies_discovered if csca_command_enabled?🙂bestiary)
disc += items_discovered if csca_command_enabled?🙂item)
disc += weapons_discovered if csca_command_enabled?🙂weapon)
disc += armors_discovered if csca_command_enabled?🙂armor)
disc += skills_discovered if csca_command_enabled?🙂skill)
disc += states_discovered if csca_command_enabled?🙂state)
for i in 0...CSCA_ENCYCLOPEDIA::KEYS.size
disc += 1 if @csca_custom_enc
end
return disc.to_f/total
end

def csca_commands
CSCA_ENCYCLOPEDIA::COMMANDS
end

def csca_command_enabled?(category)
for i in 0..csca_commands.size
next if csca_commands.nil?
return true if csca_commands[0] == category && csca_commands[2]
end
return false
end

def csca_category_text(category)
for i in 0..csca_commands.size
return csca_commands[1] if csca_commands[0] == category
end
return ""
end

def csca_custom_text(symbol)
for i in 0..CSCA_ENCYCLOPEDIA::CUSTOM.size
if CSCA_ENCYCLOPEDIA::CUSTOM[1] == symbol
return CSCA_ENCYCLOPEDIA::CUSTOM[0]
end
end
return ""
end

end
class Game_Enemy < Game_Battler
alias csca_collapse perform_collapse_effect
def perform_collapse_effect
csca_collapse
$game_party.csca_set_discovered(enemy)
$game_party.csca_set_defeated(enemy)
end
end
class Game_Actor < Game_Battler
alias csca_enc_learn_skill learn_skill
def learn_skill(skill_id)
$game_party.csca_set_discovered($data_skills[skill_id]) unless skill_learn?($data_skills[skill_id])
csca_enc_learn_skill(skill_id)
end
end
class Game_Battler < Game_BattlerBase
alias csca_enc_add_new_state add_new_state
def add_new_state(state_id)
$game_party.csca_set_discovered($data_states[state_id]) if csca_actor_check
csca_enc_add_new_state(state_id)
end
def csca_actor_check
return true if actor?
return true if !actor? && !CSCA_ENCYCLOPEDIA::ACTOR_ONLY
return false
end
end
class RPG::BaseItem
def csca_encyclopedia_exclude?
@note =~ //i
end
def csca_custom_note
@note =~ //i ? $1.to_s : ""
end
def csca_custom_picture
@note =~ //i ? $1.to_s : ""
end
end
class RPG::Enemy < RPG::BaseItem
def csca_locations
@note =~ //i ? $1.to_s : ""
end
end
 

Spoiler
#==============================================================================
#
# ▼ Yanfly Engine Ace - Adjust Limits v1.00
# -- Last Updated: 2011.12.03
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-AdjustLimits"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.03 - Finished Script.
# 2011.12.02 - Started Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# There exists some limitations in RPG Maker VX Ace that not everybody's fond
# of. With this script, you can easily adjust the limits of each limitation.
# Here's the list of various limits that can be changed:
#
# - Gold Max - Have more than 99,999,999 gold.
# - Item Max - Have more than 99 items. Customizable per item, too.
# - Level Max - Exceed 99 levels. Parameters are automatically calculated based
# on the level 99 and level 98 stats in the class parameters.
# - Stat Max - Stats can exceed 999. Does not adjust for current formulas.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
#
# Sets the initial level for the specific actor. Can go above level 99 as long
# as the max level is higher than 99. Default initial level limit is 99.
#
#
# Sets the max level for the specific actor. Can go above level 99 as long as
# the higher limit is defined in the module. Default max level is level 99.
#
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
#
# This actually goes inside of the skill learning "notes" box. Replace x with
# the level you wish for the class to learn the skill at. This enables classes
# to learn new skills past level 99.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
#
# Changes the maximum number of items that can be held from whatever the
# normal amount that can be held. Default amount is 99.
#
#
# Changes the price of the item to x. Allows you to go over the price of
# 999,999 gold if your maximum gold exceeds that amount. Default maximum gold
# is 99,999,999 gold.
#
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
#
# Changes the maximum number of items that can be held from whatever the
# normal amount that can be held. Default amount is 99.
#
#
# Changes the price of the item to x. Allows you to go over the price of
# 999,999 gold if your maximum gold exceeds that amount. Default maximum gold
# is 99,999,999 gold.
#
#
#
# Changes the stat bonus of the piece of equipment to yield +x or -x. Allows
# bonus to go over +500 and under -500. Replace stat with one of the following:
# MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK
#
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armours notebox in the database.
# -----------------------------------------------------------------------------
#
# Changes the maximum number of items that can be held from whatever the
# normal amount that can be held. Default amount is 99.
#
#
# Changes the price of the item to x. Allows you to go over the price of
# 999,999 gold if your maximum gold exceeds that amount. Default maximum gold
# is 99,999,999 gold.
#
#
#
# Changes the stat bonus of the piece of equipment to yield +x or -x. Allows
# bonus to go over +500 and under -500. Replace stat with one of the following:
# MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemy notebox in the database.
# -----------------------------------------------------------------------------
#
# Changes the stat of the enemy to x value. Allows going over the database max
# values. Replace stat with one of the following:
# MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK, EXP, GOLD
#
# -----------------------------------------------------------------------------
# Script Calls - These commands are used with script calls.
# -----------------------------------------------------------------------------
# gain_gold(x)
# lose_gold(x)
# Causes the player to gain/lose x gold. Allows you to go over 9,999,999 gold.
# Default maximum gold is 99,999,999.
#
# gain_item(x, y)
# lose_item(x, y)
# gain_weapon(x, y)
# lose_weapon(x, y)
# gain_armour(x, y)
# lose_armour(x, y)
# Causes the player to gain/lose x item in y amount. Allows you to go over 99
# quantity. Default quantity is 99.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
module LIMIT

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Gold Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Adjust gold settings here. You can change the maximum amount of gold to
# whatever you want. In addition to that, you can also adjust whether or
# not you wish for your gold display to show an icon instead, (and change
# the font size if needed). If there's too much gold that's to be displayed
# then you can change the text shown in place of that.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
GOLD_MAX = 999999999999999 # Maximum gold.
GOLD_ICON = 361 # Icon used for gold. Use 0 for text currency.
GOLD_FONT = 16 # Font size used to display gold.
TOO_MUCH_GOLD = "A lotta gold!" # Text used when gold cannot fit.

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Item Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Adjust item settings here. You can change the maximum number of items
# held from 99 to whatever you want. In addition to that, change the prefix
# used for items when shown in the item display menu (and the font size if
# needed). Items can have individual maximums through usage of the
# notetag.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ITEM_MAX = 9999 # The default maximum number of items held each.
ITEM_FONT = 16 # Font size used to display item quantity.
SHOP_FONT = 16 # Font size used for shop item costs.
ITEM_PREFIX = "×%s" # Prefix used for item quantity in item lists.

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Parameter Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Adjust the limits for each of the various stats (for MaxHP, MaxMP, ATK,
# DEF, MAT, and more). Adjust them as you see fit.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
LEVEL_MAX = 9999 # Sets max level to x for those with 99 level limit.
MAXHP_MAX = 9999999 # Sets MaxHP to something higher than 9999.
MAXMP_MAX = 9999999 # Sets MaxMP to something higher than 9999.
PARAM_MAX = 99999 # Sets stat max for something higher than 999.
EQUIP_FONT = 16 # Changes the default equip window font size.

end # LIMIT
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

module YEA
module REGEXP
module ACTOR

MAX_LEVEL = /<(?:MAX_LEVEL|max level):[ ](\d+)>/i
INITIAL_LEVEL = /<(?:INITIAL_LEVEL|initial level):[ ](\d+)>/i

end # ACTOR
module CLASS

LEARN_AT_LV = /<(?:LEARN_AT_LEVEL|learn at level):[ ](\d+)>/i

end # CLASS
module BASEITEM

PRICE = /<(?:GOLD|price|COST):[ ](\d+)>/i
MAX_LIMIT = /<(?:MAX_LIMIT|max limit):[ ](\d+)>/i
STAT_SET = /<(.*):[ ]*([\+\-]\d+)>/i

end # BASEITEM
module ENEMY

STAT_SET = /<(.*):[ ]*(\d+)>/i

end # ENEMY
end # REGEXP
end # YEA

#==============================================================================
# ■ Icon
#==============================================================================

module Icon

#--------------------------------------------------------------------------
# self.gold
#--------------------------------------------------------------------------
def self.gold; return YEA::LIMIT::GOLD_ICON; end

end # Icon

#==============================================================================
# ■ Numeric
#==============================================================================

class Numeric

#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def group; return self.to_s; end
end # $imported["YEA-CoreEngine"]

end # Numeric

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager

#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class < def self.load_database
load_database_al
load_notetags_al
end

#--------------------------------------------------------------------------
# new method: load_notetags_al
#--------------------------------------------------------------------------
def self.load_notetags_al
groups = [$data_actors, $data_items, $data_weapons, $data_armors,
$data_enemies, $data_classes]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_al
end
end
end

end # DataManager

#==============================================================================
# ■ RPG::Actor
#==============================================================================

class RPG::Actor < RPG::BaseItem

#--------------------------------------------------------------------------
# common cache: load_notetags_al
#--------------------------------------------------------------------------
def load_notetags_al
@max_level = YEA::LIMIT::LEVEL_MAX if @max_level == 99
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::ACTOR::MAX_LEVEL
@max_level = [[$1.to_i, 1].max, YEA::LIMIT::LEVEL_MAX].min
@initial_level = [@initial_level, @max_level].min
when YEA::REGEXP::ACTOR::INITIAL_LEVEL
@initial_level = [[$1.to_i, 1].max, @max_level].min
#---
end
} # self.note.split
#---
end

end # RPG::Actor

#==============================================================================
# ■ RPG::Class
#==============================================================================

class RPG::Class < RPG::BaseItem

#--------------------------------------------------------------------------
# new method: above_lv99_params
#--------------------------------------------------------------------------
def above_lv99_params(param_id, level)
return @params[param_id, level] if level <= 99
n = @params[param_id, 99]
multiplier = [level - 99, 1].max
change = (@params[param_id, 99] - @params[param_id, 98]) + 1
n += change * multiplier
return n
end

#--------------------------------------------------------------------------
# new method: load_notetags_al
#--------------------------------------------------------------------------
def load_notetags_al
for item in @learnings; item.load_notetags_al; end
end

end # RPG::Class

#==============================================================================
# ■ RPG::Class::Learning
#==============================================================================

class RPG::Class::Learning

#--------------------------------------------------------------------------
# common cache: load_notetags_al
#--------------------------------------------------------------------------
def load_notetags_al
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::CLASS::LEARN_AT_LV
@level = [[$1.to_i, 1].max, YEA::LIMIT::LEVEL_MAX].min
#---
end
} # self.note.split
#---
end

end # RPG::Class::Learning

#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::BaseItem

#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :max_limit

#--------------------------------------------------------------------------
# common cache: load_notetags_al
#--------------------------------------------------------------------------
def load_notetags_al
@max_limit = YEA::LIMIT::ITEM_MAX
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM:😛RICE
@price = [$1.to_i, YEA::LIMIT::GOLD_MAX].min
when YEA::REGEXP::BASEITEM::MAX_LIMIT
@max_limit = [$1.to_i, 1].max
when YEA::REGEXP::BASEITEM::STAT_SET
case $1.upcase
when "HP", "MAXHP", "MHP"
@params[0] = $2.to_i
when "MP", "MAXMP", "MMP", "SP", "MAXSP", "MSP"
@params[1] = $2.to_i
when "ATK"
@params[2] = $2.to_i
when "DEF"
@params[3] = $2.to_i
when "MAT", "INT", "SPI"
@params[4] = $2.to_i
when "MDF", "RES"
@params[5] = $2.to_i
when "AGI", "SPD"
@params[6] = $2.to_i
when "LUK", "LUCK"
@params[7] = $2.to_i
end
#---
end
} # self.note.split
#---
end

#--------------------------------------------------------------------------
# new method: max_limit
#--------------------------------------------------------------------------
def max_limit; return @max_limit; end

end # RPG::BaseItem

#==============================================================================
# ■ RPG::Enemy
#==============================================================================

class RPG::Enemy < RPG::BaseItem

#--------------------------------------------------------------------------
# common cache: load_notetags_al
#--------------------------------------------------------------------------
def load_notetags_al
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::ENEMY::STAT_SET
case $1.upcase
when "HP", "MAXHP", "MHP"
@params[0] = $2.to_i
when "MP", "MAXMP", "MMP", "SP", "MAXSP", "MSP"
@params[1] = $2.to_i
when "ATK"
@params[2] = $2.to_i
when "DEF"
@params[3] = $2.to_i
when "MAT", "INT", "SPI"
@params[4] = $2.to_i
when "MDF", "RES"
@params[5] = $2.to_i
when "AGI", "SPD"
@params[6] = $2.to_i
when "LUK", "LUCK"
@params[7] = $2.to_i
when "EXP", "XP"
@exp = $2.to_i
when "GOLD", "GP"
@gold = $2.to_i
end
#---
end
} # self.note.split
#---
end

end # RPG::Enemy

#==============================================================================
# ■ Game_BattlerBase
#==============================================================================

class Game_BattlerBase

#--------------------------------------------------------------------------
# overwrite method: param_max
#--------------------------------------------------------------------------
def param_max(param_id)
return YEA::LIMIT::MAXHP_MAX if param_id == 0
return YEA::LIMIT::MAXMP_MAX if param_id == 1
return YEA::LIMIT:😛ARAM_MAX
end

end # Game_BattlerBase

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

#--------------------------------------------------------------------------
# overwrite method: param_max
#--------------------------------------------------------------------------
def param_max(param_id)
return super
end

#--------------------------------------------------------------------------
# overwrite method: param_base
#--------------------------------------------------------------------------
def param_base(param_id)
return self.class.params[param_id, @level] if @level <= 99
return self.class.above_lv99_params(param_id, @level)
end

#--------------------------------------------------------------------------
# new method: check_levels
#--------------------------------------------------------------------------
def check_levels
last_level = @level
@level = [[@level, max_level].min, 1].max
return if @level == last_level
change_exp(exp_for_level(@level), false)
end

end # Game_Actor

#==============================================================================
# ■ Game_Party
#==============================================================================

class Game_Party < Game_Unit

#--------------------------------------------------------------------------
# overwrite method: max_gold
#--------------------------------------------------------------------------
def max_gold; return YEA::LIMIT::GOLD_MAX; end

#--------------------------------------------------------------------------
# overwrite method: max_item_number
#--------------------------------------------------------------------------
def max_item_number(item); return item.max_limit; end

end # Game_Party

#==============================================================================
# ■ Game_Interpreter
#==============================================================================

class Game_Interpreter

#--------------------------------------------------------------------------
# new method: gain_gold
#--------------------------------------------------------------------------
def gain_gold(value); $game_party.gain_gold(value); end

#--------------------------------------------------------------------------
# new method: lose_gold
#--------------------------------------------------------------------------
def lose_gold(value); $game_party.lose_gold(value); end

#--------------------------------------------------------------------------
# new method: gain_item
#--------------------------------------------------------------------------
def gain_item(id, amount)
return if $data_items[id].nil?
$game_party.gain_item($data_items[id], amount)
end

#--------------------------------------------------------------------------
# new method: lose_item
#--------------------------------------------------------------------------
def lose_item(id, amount)
return if $data_items[id].nil?
$game_party.lose_item($data_items[id], amount)
end

#--------------------------------------------------------------------------
# new method: gain_weapon
#--------------------------------------------------------------------------
def gain_weapon(id, amount)
return if $data_weapons[id].nil?
$game_party.gain_item($data_weapons[id], amount)
end

#--------------------------------------------------------------------------
# new method: lose_weapon
#--------------------------------------------------------------------------
def lose_weapon(id, amount)
return if $data_weapons[id].nil?
$game_party.lose_item($data_weapons[id], amount)
end

#--------------------------------------------------------------------------
# new method: gain_armour
#--------------------------------------------------------------------------
def gain_armour(id, amount)
return if $data_armors[id].nil?
$game_party.gain_item($data_armors[id], amount)
end

#--------------------------------------------------------------------------
# new method: lose_armour
#--------------------------------------------------------------------------
def lose_armour(id, amount)
return if $data_armors[id].nil?
$game_party.lose_item($data_armors[id], amount)
end

#--------------------------------------------------------------------------
# new method: gain_armor
#--------------------------------------------------------------------------
def gain_armor(id, amount)
return if $data_armors[id].nil?
$game_party.gain_item($data_armors[id], amount)
end

#--------------------------------------------------------------------------
# new method: lose_armor
#--------------------------------------------------------------------------
def lose_armor(id, amount)
return if $data_armors[id].nil?
$game_party.lose_item($data_armors[id], amount)
end

end # Game_Interpreter

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window

#--------------------------------------------------------------------------
# overwrite method: draw_actor_level
#--------------------------------------------------------------------------
def draw_actor_level(actor, dx, dy)
dw = text_size(Vocab::level_a + YEA::LIMIT::LEVEL_MAX.to_s).width
change_color(system_color)
draw_text(dx, dy, dw, line_height, Vocab::level_a)
change_color(normal_color)
cx = text_size(Vocab::level_a).width
draw_text(dx + cx, dy, dw, line_height, actor.level.group, 2)
end

#--------------------------------------------------------------------------
# overwrite method: draw_actor_param
#--------------------------------------------------------------------------
def draw_actor_param(actor, dx, dy, param_id)
change_color(system_color)
draw_text(dx, dy, 120, line_height, Vocab:😛aram(param_id))
change_color(normal_color)
draw_text(dx, dy, 156, line_height, actor.param(param_id).group, 2)
end

#--------------------------------------------------------------------------
# draw_currency_value
#--------------------------------------------------------------------------
def draw_currency_value(value, unit, dx, dy, dw)
contents.font.size = YEA::LIMIT::GOLD_FONT
cx = gold_icon?(unit) ? 24 : text_size(unit).width
change_color(normal_color)
text = value.group
text = YEA::LIMIT::TOO_MUCH_GOLD if contents.text_size(text).width > dw-cx
draw_text(dx, dy, dw - cx - 2, line_height, text, 2)
change_color(system_color)
draw_icon(Icon.gold, dx+dw-24, dy) if gold_icon?(unit)
draw_text(dx, dy, dw, line_height, unit, 2) unless gold_icon?(unit)
reset_font_settings
end

#--------------------------------------------------------------------------
# new method: gold_icon?
#--------------------------------------------------------------------------
def gold_icon?(unit)
return false if unit != Vocab.currency_unit
return YEA::LIMIT::GOLD_ICON > 0
end

end # Window_Base

#==============================================================================
# ■ Window_ItemList
#==============================================================================

class Window_ItemList < Window_Selectable

#--------------------------------------------------------------------------
# overwrite method: draw_item_number
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
contents.font.size = YEA::LIMIT::ITEM_FONT
quantity = $game_party.item_number(item).group
text = sprintf(YEA::LIMIT::ITEM_PREFIX, quantity)
draw_text(rect, text, 2)
reset_font_settings
end

end # Window_ItemList

#==============================================================================
# ■ Window_EquipStatus
#==============================================================================

class Window_EquipStatus < Window_Base

#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(dx, dy, param_id)
draw_param_name(dx + 4, dy, param_id)
draw_current_param(dx + 64, dy, param_id) if @actor
draw_right_arrow(dx + 110, dy)
draw_new_param(dx + 132, dy, param_id) if @temp_actor
reset_font_settings
end

#--------------------------------------------------------------------------
# overwrite method: draw_param_name
#--------------------------------------------------------------------------
def draw_param_name(dx, dy, param_id)
contents.font.size = YEA::LIMIT::EQUIP_FONT
change_color(system_color)
draw_text(dx, dy, contents.width, line_height, Vocab:😛aram(param_id))
end

#--------------------------------------------------------------------------
# overwrite method: draw_current_param
#--------------------------------------------------------------------------
def draw_current_param(dx, dy, param_id)
change_color(normal_color)
draw_text(0, dy, dx+48, line_height, @actor.param(param_id).group, 2)
reset_font_settings
end

#--------------------------------------------------------------------------
# overwrite method: draw_new_param
#--------------------------------------------------------------------------
def draw_new_param(dx, dy, param_id)
contents.font.size = YEA::LIMIT::EQUIP_FONT
new_value = @temp_actor.param(param_id)
change_color(param_change_color(new_value - @actor.param(param_id)))
draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
reset_font_settings
end

end # Window_EquipStatus

#==============================================================================
# ■ Window_ShopBuy
#==============================================================================

class Window_ShopBuy < Window_Selectable

#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
rect = item_rect(index)
draw_item_name(item, rect.x, rect.y, enable?(item))
rect.width -= 4
contents.font.size = YEA::LIMIT::SHOP_FONT
draw_text(rect, price(item).group, 2)
reset_font_settings
end

end # Window_ShopBuy

#==============================================================================
# ■ Scene_Load
#==============================================================================

class Scene_Load < Scene_File

#--------------------------------------------------------------------------
# alias method: on_load_success
#--------------------------------------------------------------------------
alias on_load_success_al on_load_success
def on_load_success
on_load_success_al
perform_level_check
end

#--------------------------------------------------------------------------
# new method: perform_level_check
#--------------------------------------------------------------------------
def perform_level_check
for i in 1..$data_actors.size
next if $game_actors.nil?
$game_actors.check_levels
end
end

end # Scene_Load

#==============================================================================
#
# ▼ End of File
#
#==============================================================================
Up
Up
Up
Up
Up
Up
Up
Up
Up
Up

Original thread: https://forums.rpgmakerweb.com/threads/vxace-problem-csca-encyclopedia.38992/