- AsagiMembre
- Nombre de messages : 290
Age : 30
Localisation : France
Distinction : aucune
Date d'inscription : 30/01/2011
Encyclopedie
Mer 30 Jan 2013 - 3:42
Salut tout le monde, je vous propose un super script qui fait bestiaire mais pas que, il fait aussi un liste d'arme et objets. c'est vraiment a tester ! d’ailleurs j'ai traduit quelque parti.
╠═════Informations|═════╣
.•*´¨`*•.¸¸.•*´¨`*•.¸¸.•*´¨`* •.¸¸.•*´¨`*•.¸¸.•
::: (\_(\ ...*...*...*...*...*...*...*.. .*...*...*...*...*
*: (=' :') : Download: Aucun
•.. (,(")(")¤...*...*...*...*... *...*...*...*...*...*...*
Nom: Encyclopédie
Auteur: Yanfly
Niveau de difficulté: Facile
Démo: aucune
Compatibilité avec les autres script : Oui
╠═════Informations|═════╣
+1pt de participation
╠═════Informations|═════╣
.•*´¨`*•.¸¸.•*´¨`*•.¸¸.•*´¨`* •.¸¸.•*´¨`*•.¸¸.•
::: (\_(\ ...*...*...*...*...*...*...*.. .*...*...*...*...*
*: (=' :') : Download: Aucun
•.. (,(")(")¤...*...*...*...*... *...*...*...*...*...*...*
Nom: Encyclopédie
Auteur: Yanfly
Niveau de difficulté: Facile
Démo: aucune
Compatibilité avec les autres script : Oui
╠═════Informations|═════╣
- Code:
=begin
CSCA Encyclopedia
version: 1.2 (Released: April 29, 2012)
Created by: Casper667 from http://www.caspergaming.com/
Compatibility:
Should be compatible with almost any script.
IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
otherwise noted.
Overwrites: none.
Aliases: create_command_window in Scene_Menu, make_command_list in
Window_MenuCommand, init_all_items and gain_item in Game_Party,
perform_collapse_effect in Game_Enemy
UPDATES:
version 1.1(April 14th, 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 29th, 2012)
- No more max items listed. If you want to leave an item/enemy/etc. unlisted now,
use the notetag <csca enc exclude>.
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, and enemy parameters.
ITEMS: Shows sprite (stretched bigger), item name, key item status, price,
HP Effect, MP Effect, TP Gain, success rate, occasion(menu/battle/none/both),
and state applications and removals.
WEAPONS: Shows sprite (stretched bigger), weapon name, price, type, parameters,
speed bonus, state applications, and attack element.
ARMORS: Shows sprite (stretched bigger), armor name, slot, price, type,
parameters, state resists, and special effects(such as 2x gold).
SETUP
This script requires setup further down.
Instructions included below.
CREDIT & TERMS
Free to use in noncommercial games if credit is given to:
casper667 from http://www.caspergaming.com/
If using in commercial game, please contact me.
www.rpgmakervxace.net/user/193-casper667/
or
www.caspergaming.com
=end
module CSCA_ENCYCLOPEDIA # Don't touch this.
#######################
# NEW NOTEBOX FEATURE #
#######################
# If you have an item/whatever you don't want to be listed, put this notetag
# code in the item/whatever's notebox. <csca enc exclude>
# Miscellaneous options
ADD_TO_MENU = true # Add this script as a menu option? If you have a custom
# menu script that causes issues with this script, turn this to false.
# To call this script outside of the menu, use:
# SceneManager.call(Scene_CSCA_Encyclopedia)
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.
VARIABLE = 0 # Variable ID. If you need to set an item/enemy/etc to discovered
# since the player defeats it in an abnormal way(possible bosses not "collapsing"
# etc.), set this variable to that enemy's(or item, etc.) ID. Then, make one
# of the following script calls:
#
# $game_party.csca_set_enemy_true # Sets enemy ID in variable to discovered
# $game_party.csca_set_item_true # Sets item ID in variable to discovered
# $game_party.csca_set_weapon_true # Sets weapon ID in variable to discovered
# $game_party.csca_set_armor_true # Sets armor ID in variable to discovered
#
# Set the variable to 0 if you do not plan on using this feature.
# Vocab. The following are text that appear in the windows.
BESTIARY = "Bestiare" # Bestiary Command
ITEM = "Objets" # Item Command
WEAPON = "Armes" # Weapon Command
ARMOR = "Armures" # Armor Command
TOTALS = "Tout" # Totals window centered text
B_TOTAL = "Bestiare" # Bestiary total text
I_TOTAL = "Objets" # Items total text
W_TOTAL = "Armes" # Weapons total text
A_TOTAL = "Armures" # Armors total text
SCENE_NAME = "Encyclopedie" # Name window displayed at top during scene.
COMMAND_NAME = "Encyclopedie" # Name of Menu Command(Only displayed if enabled)
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 above the info window instruction players how to toggle opacity
# of the monster sprites.
TRIGGER_TEXT = "Press Action button to toggle bestiary sprites."
# 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
ARMOR_TYPE = [] # Don't touch this
WEAPON_TYPE = [] # Don't touch this either.
ELEMENTS = [] # Don't touch this one either.
ARMOR_TYPE[0] = "None" # Text for no armor type.
ARMOR_TYPE[1] = "General Armor" # Text for armor type 1 in database.
ARMOR_TYPE[2] = "Magic Armor" # Text for armor type 2 in database.
ARMOR_TYPE[3] = "Light Armor" # Text for armor type 3 in database.
ARMOR_TYPE[4] = "Heavy Armor" # Text for armor type 4 in database.
ARMOR_TYPE[5] = "Small Shield" # Text for armor type 5 in database.
ARMOR_TYPE[6] = "Large Shield" # Text for armor type 6 in database.
WEAPON_TYPE[0] = "None" # Text for no weapon type.
WEAPON_TYPE[1] = "Axe" # Text for weapon type 1 in database.
WEAPON_TYPE[2] = "Claw" # Text for weapon type 2 in database.
WEAPON_TYPE[3] = "Spear" # Text for weapon type 3 in database.
WEAPON_TYPE[4] = "Sword" # Text for weapon type 4 in database.
WEAPON_TYPE[5] = "Katana" # Text for weapon type 5 in database.
WEAPON_TYPE[6] = "Bow" # Text for weapon type 6 in database.
WEAPON_TYPE[7] = "Dagger" # Text for weapon type 7 in database.
WEAPON_TYPE[8] = "Hammer" # Text for weapon type 8 in database.
WEAPON_TYPE[9] = "Staff" # Text for weapon type 9 in database.
WEAPON_TYPE[10] = "Gun" # Text for weapon type 10 in database.
ELEMENTS[0] = "None" # Text for no element type.
ELEMENTS[1] = "Physical" # Text for element type 1 in database.
ELEMENTS[2] = "Absorb" # Text for element type 2 in database.
ELEMENTS[3] = "Fire" # Text for element type 3 in database.
ELEMENTS[4] = "Ice" # Text for element type 4 in database.
ELEMENTS[5] = "Thunder" # Text for element type 5 in database.
ELEMENTS[6] = "Water" # Text for element type 6 in database.
ELEMENTS[7] = "Earth" # Text for element type 7 in database.
ELEMENTS[8] = "Wind" # Text for element type 8 in database.
ELEMENTS[9] = "Holy" # Text for element type 9 in database.
ELEMENTS[10] = "Dark" # Text for element type 10 in database.
end # Don't touch this or anything below.
$imported = {} if $imported.nil?
$imported["CSCA-Encyclopedia"] = true
if CSCA_ENCYCLOPEDIA::ADD_TO_MENU
class Scene_Menu < Scene_MenuBase
alias csca_create_command_window create_command_window
def create_command_window
csca_create_command_window
@command_window.set_handler(:encyclopedia, method(:csca_encyclopedia_select))
end
def csca_encyclopedia_select
SceneManager.call(Scene_CSCA_Encyclopedia)
end
end
class Window_MenuCommand < Window_Command
alias csca_make_commands make_command_list
def make_command_list
add_main_commands
add_formation_command
add_original_commands
csca_add_custom_commands
add_save_command
add_game_end_command
end
def csca_add_custom_commands
add_command(CSCA_ENCYCLOPEDIA::COMMAND_NAME, :encyclopedia)
end
end
end # Add to menu?
class Scene_CSCA_Encyclopedia < Scene_MenuBase
def start
super
create_head_window
create_command_window
create_dummy_window
create_csca_info_window
create_totals_window
create_csca_list_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_EncyclopediaMainHead.new(0, 0)
@head_window.viewport = @viewport
end
def create_dummy_window
wy = @command_window.y + @command_window.height
wh = Graphics.height - wy
@dummy_window = Window_Base.new(Graphics.width / 2, wy, Graphics.width / 2, wh)
@dummy_window.viewport = @viewport
end
def create_totals_window
wy = @head_window.height
wx = @command_window.width
wh = @command_window.height
wl = Graphics.width - @command_window.width
@total_window = CSCA_Window_EncyclopediaTotals.new(wx, wy, wl, wh)
@total_window.viewport = @viewport
end
def create_csca_list_window
height = @dummy_window.height
width = @dummy_window.width
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(Graphics.width / 2, wy, Graphics.width / 2, 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_EncyclopediaMainHead < Window_Base
def initialize(x, y)
super(x, y, 544, line_height * 2)
refresh
end
def refresh
contents.clear
draw_text(0, 0, contents.width, line_height, CSCA_ENCYCLOPEDIA::SCENE_NAME, 1)
end
end
class CSCA_Window_EncyclopediaTotals < Window_Base
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
def refresh
contents.clear
bestiary_string_helper = $data_enemies.size - 1
for i in 0..$data_enemies.size
if $data_enemies[i].is_a?(RPG::Enemy)
bestiary_string_helper -= 1 if $data_enemies[i].csca_encyclopedia_exclude?
end
end
bestiary_string = CSCA_ENCYCLOPEDIA::B_TOTAL + ": " +
$game_party.enemies_discovered.to_s + "/" + bestiary_string_helper.to_s
items_string_helper = $game_party.csca_items.size - 2
for i in 0..$data_items.size
if $data_items[i].is_a?(RPG::Item)
items_string_helper -= 1 if $data_items[i].csca_encyclopedia_exclude?
end
end
items_string = CSCA_ENCYCLOPEDIA::I_TOTAL + ": " +
$game_party.items_discovered.to_s + "/" + items_string_helper.to_s
weapons_string_helper = $game_party.csca_weapons.size - 2
for i in 0..$data_weapons.size
if $data_weapons[i].is_a?(RPG::Weapon)
weapons_string_helper -= 1 if $data_weapons[i].csca_encyclopedia_exclude?
end
end
weapons_string = CSCA_ENCYCLOPEDIA::W_TOTAL + ": " +
$game_party.weapons_discovered.to_s + "/" + weapons_string_helper.to_s
armors_string_helper = $game_party.csca_armors.size - 2
for i in 0..$data_armors.size
if $data_armors[i].is_a?(RPG::Armor)
armors_string_helper -= 1 if $data_armors[i].csca_encyclopedia_exclude?
end
end
armors_string = CSCA_ENCYCLOPEDIA::A_TOTAL + ": " +
$game_party.armors_discovered.to_s + "/" + armors_string_helper.to_s
draw_text(0,0,contents.width,line_height,CSCA_ENCYCLOPEDIA::TOTALS, 1)
draw_text(0,line_height,contents.width/2,line_height,bestiary_string)
draw_text(0,line_height*2,contents.width/2,line_height,items_string)
draw_text(contents.width/2,line_height*2,contents.width/2,line_height,weapons_string)
draw_text(contents.width/2,line_height,contents.width/2,line_height,armors_string)
draw_text(0,line_height*3,contents.width+50,line_height,CSCA_ENCYCLOPEDIA::TRIGGER_TEXT)
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::Enemy)
if sprite_in_front == 1
csca_draw_enemy_sprite(item)
else
draw_enemy_information(item)
end
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"
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(72,line_height,contents.width,line_height, "Key item: " + 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:")
occasion = ""
case item.occasion
when 0
occasion = "Always"
when 1
occasion = "Battle Only"
when 2
occasion = "Menu only"
when 3
occassion = "Never"
end
draw_text(0,line_height*8-10,contents.width,line_height,"Occasion: " + occasion)
draw_text(0,line_height*9-14,contents.width,line_height,"Success Rate: " + 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)
end
def draw_weapon_information(item)
csca_draw_icon(item)
csca_draw_name(item)
contents.font.size = 20
draw_text(72,line_height,contents.width,line_height,"Type:")
csca_draw_type(item,120,line_height,contents.width-120,line_height)
csca_draw_price(item)
csca_draw_all_params(item)
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:")
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)
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(72,line_height,contents.width,line_height, "Armor Slot: " + type)
csca_draw_all_params(item)
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:")
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
case feature.code
when 64; string = feature.data_id
end
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)
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(0,line_height*6,contents.width,line_height,"Treasures: 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)
string = $game_party.csca_enemies_defeated(item).to_s
draw_text(0,line_height*9-12,contents.width,line_height,"Number Defeated: " + string)
end
def csca_draw_enemy_sprite(item, opacity = 255)
bitmap = Cache.battler(item.battler_name, item.battler_hue)
rect = Rect.new(0,0,bitmap.width,bitmap.height)
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, 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
reward = item.gold
string1 = "Currency: "
string2 = Vocab::currency_unit
else
reward = item.exp
string1 = "Experience: "
string2 = ""
end
million = reward / 1000 / 1000
thousand = reward / 1000 % 1000
hundred = reward % 1000
if million >= 1
draw_text(0,y,contents.width,line_height,sprintf(string1 +
"%d,%03d,%03d" + string2, million, thousand, hundred))
elsif million == 0 && thousand >= 1
draw_text(0,y,contents.width,line_height,sprintf(string1 +
"%d,%03d" + string2, thousand, hundred))
else
draw_text(0,y,contents.width,line_height,sprintf(string1 +
"%d" + string2, hundred))
end
end
def csca_draw_icon(item)
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(-6, 0, 72, 72)
contents.stretch_blt(target, bitmap, rect)
end
def csca_draw_name(item, center = 0)
contents.font.bold = true
if center != 0
draw_text(0,0,contents.width,line_height,item.name,center)
else
draw_text(72,0,contents.width-72,line_height,item.name)
end
contents.font.bold = false
end
def csca_draw_price(item)
item_price = item.price
million = item_price / 1000 / 1000
thousand = item_price / 1000 % 1000
hundred = item_price % 1000
if million >= 1
draw_text(72,line_height*2-4,contents.width,line_height,sprintf("Price" +
": %d,%03d,%03d" + Vocab::currency_unit, million, thousand, hundred))
elsif million == 0 && thousand >= 1
draw_text(72,line_height*2-4,contents.width,line_height,sprintf("Price" +
": %d,%03d" + Vocab::currency_unit, thousand, hundred))
else
draw_text(72,line_height*2-4,contents.width,line_height,sprintf("Price" +
": %d" + Vocab::currency_unit, hundred))
end
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
draw_text(0,y1,contents.width,line_height,Vocab::param(2) + ":")
draw_text(w,y1,contents.width,line_height,Vocab::param(3) + ":")
draw_text(0,y2,contents.width,line_height,Vocab::param(4) + ":")
draw_text(w,y2,contents.width,line_height,Vocab::param(5) + ":")
draw_text(0,y3,contents.width,line_height,Vocab::param(6) + ":")
draw_text(w,y3,contents.width,line_height,Vocab::param(7) + ":")
draw_text(0,y4,contents.width,line_height,Vocab::param(0) + ":")
draw_text(w,y4,contents.width,line_height,Vocab::param(1) + ":")
csca_draw_param(2, item, 55,y1)
csca_draw_param(3, item, 180,y1)
csca_draw_param(4, item, 55,y2)
csca_draw_param(5, item, 180,y2)
csca_draw_param(6, item, 55,y3)
csca_draw_param(7, item, 180,y3)
csca_draw_param(0, item, 55,y4)
csca_draw_param(1, item, 180,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,wpn = 0)
if item.is_a?(RPG::Armor)
csca_array = CSCA_ENCYCLOPEDIA::ARMOR_TYPE
string = csca_array[item.atype_id]
elsif item.is_a?(RPG::Weapon)
case wpn
when 0
csca_array = CSCA_ENCYCLOPEDIA::WEAPON_TYPE
string = csca_array[item.wtype_id]
when 1
csca_array = CSCA_ENCYCLOPEDIA::ELEMENTS
for feature in item.features
case feature.code
when 31
string = csca_array[feature.data_id]
end
end
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)
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?
icons.push($data_states[effect.data_id].icon_index)
end
icons.delete(0)
break if icons.size >= 7
else
case effect.code
when 22
next unless effect.value1 > 0
next if $data_states[effect.value1].nil?
icons.push($data_states[effect.data_id].icon_index)
end
icons.delete(0)
break if icons.size >= 7
end
end
elsif item.is_a?(RPG::Armor)
for feature in item.features
case feature.code
when 14
icons.push($data_states[feature.data_id].icon_index)
end
icons.delete(0)
break if icons.size >= 7
end
else
for feature in item.features
case feature.code
when 32
icons.push($data_states[feature.data_id].icon_index)
end
icons.delete(0)
break if icons.size >= 7
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_Command
attr_reader :csca_list_window
def initialize(x, y)
super(x, y)
end
def visible_line_number
return 4
end
def update
super
@csca_list_window.category = current_symbol if @csca_list_window
end
def make_command_list
add_command(CSCA_ENCYCLOPEDIA::BESTIARY, :bestiary)
add_command(CSCA_ENCYCLOPEDIA::ITEM, :item)
add_command(CSCA_ENCYCLOPEDIA::WEAPON, :weapon)
add_command(CSCA_ENCYCLOPEDIA::ARMOR, :armor)
end
def csca_list_window=(csca_list_window)
@csca_list_window = csca_list_window
update
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 self.csca_category
@category
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?
else
false
end
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.push(nil) if include?(nil)
end
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
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, line_height, item.name)
else
draw_item_name(item, rect.x + 40, rect.y, true)
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 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
alias csca_init_all_items init_all_items
def init_all_items
csca_init_all_items
@csca_enemies = []
@csca_items = []
@csca_weapons = []
@csca_armors = []
@csca_defeated_number = []
@enemy_number = 0
csca_init_items_discovered
end
def csca_init_items_discovered
for i in 0..$data_enemies.size
@csca_enemies[i] = false
@csca_defeated_number[i] = 0
end
for i in 0..$data_items.size
@csca_items[i] = false
end
for i in 0..$data_weapons.size
@csca_weapons[i] = false
end
for i in 0..$data_armors.size
@csca_armors[i] = false
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_set_discovered(item)
if item.is_a?(RPG::Item)
@csca_items[item.id] = true
elsif item.is_a?(RPG::Weapon)
@csca_weapons[item.id] = true
elsif item.is_a?(RPG::Armor)
@csca_armors[item.id] = true
elsif item.is_a?(RPG::Enemy)
@csca_enemies[item.id] = true
end
end
def csca_set_defeated(enemy)
@csca_defeated_number[enemy.id] += 1
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]
end
end
def enemies_discovered
number = 0
for i in 0..@csca_enemies.size
if @csca_enemies[i] == true && !$data_enemies[i].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[i] == true && !$data_items[i].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[i] == true && !$data_weapons[i].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[i] == true && !$data_armors[i].csca_encyclopedia_exclude?
number += 1
end
end
return number
end
def csca_set_enemy_true
@csca_enemies[$game_variables[CSCA_ENCYCLOPEDIA::VARIABLE]] = true
end
def csca_set_item_true
@csca_items[$game_variables[CSCA_ENCYCLOPEDIA::VARIABLE]] = true
end
def csca_set_armor_true
@csca_armors[$game_variables[CSCA_ENCYCLOPEDIA::VARIABLE]] = true
end
def csca_set_weapon_true
@csca_weapons[$game_variables[CSCA_ENCYCLOPEDIA::VARIABLE]] = true
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 RPG::BaseItem
def csca_encyclopedia_exclude?
@note =~ /<csca enc exclude>/i
end
end
+1pt de participation
Re: Encyclopedie
Ven 1 Fév 2013 - 20:24
C'est un très bon script, n'utilisez pas "l'encyclopédie" avec vos anciennes sauvegarde.
Il faudrait aussi le traduire ... Si j'ai le temps je le ferais .
Il faudrait aussi le traduire ... Si j'ai le temps je le ferais .
- BalbereithStaffeux retraité
- Nombre de messages : 4129
Age : 32
Localisation : dans l'ombre...
Distinction : Péripatéticienne à temps perdu
Helly n°666 [Coco' ;D]
mon ptit balbounet p'tit jardinier en herbe(les râteaux ça le connait) [tonton Adurna]
Cultivateur professionnel de la commu' (il a de bons outils en de nombreux exemplaires ) [Coco' ]
Date d'inscription : 13/05/2009
Re: Encyclopedie
Dim 3 Fév 2013 - 17:11
Merci du partage, +1 pt de participation.
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum