- NérylisMembre
- Nombre de messages : 615
Age : 35
Localisation : Seine Maritime
Distinction : aucune
Date d'inscription : 23/11/2014
Wallpaper
Dim 10 Mai 2015 - 10:25
Coucou,
J'utilise un script pour changer le wallpaper des menus. Dans la configuration, il faut renseigner toutes les "Scenes" impactées par ce changement de wallpaper. J'ai intégré tous les écrans, mais l'un d'entre eux reste par défaut sans que je comprenne pourquoi. Il s'agit du menu de craft (Scene_Crafting).
Le script du Wallpaper est ici :
Celui du craft ici :
J'utilise un script pour changer le wallpaper des menus. Dans la configuration, il faut renseigner toutes les "Scenes" impactées par ce changement de wallpaper. J'ai intégré tous les écrans, mais l'un d'entre eux reste par défaut sans que je comprenne pourquoi. Il s'agit du menu de craft (Scene_Crafting).
Le script du Wallpaper est ici :
- Code:
#==============================================================================
# +++ MOG - Wallpaper EX (V2.1) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# - Adiciona um papel de parede e adiciona alguns efeitos animados.
#==============================================================================
# Para mudar de papel de parede no meio do jogo basta usar o
# código abaixo.
#
# wallpaper(file_name, scroll_x, scroll_y)
#
# EX
#
# wallpaper("Wallpaper01",3,0)
#
#==============================================================================
# Use o código abaixo para mudar a imagem da particula.
#
# particle_name(file_name)
#
#==============================================================================
# Para mudar a opacidade da janela use o código abaixo.
#
# window_opacity(opacity)
#
# EX
#
# window_opacity(200)
#
#==============================================================================
# Serão necessários os seguintes arquivos na pasta GRAPHICS/SYSTEM.
#
# Menu_Particles.png
# Wallpaper.jpg
#
# Taille du wallpaper : 544x416
#
# Script call :
# Pour changer de wallpaper en plein jeu :
# wallpaper("Wallpaper",0,0)
# window_opacity(30)
# menu_transition("",10)
# menu_particle("Menu_Particles",0,3,0,1)
#
# Wallpaper de RPG Maker par défaut :
# wallpaper("",0,0)
# window_opacity(255)
# menu_transition("",10)
# menu_particle("",0,0,0,0)
#
#==============================================================================
module MOG_WALLPAPER_EX
#Ativar Particulas animadas.
PARTICLES = true
#Numero de particulas.
NUMBER_OF_PARTICLES = 10
#Deslizar a imagem de fundo.
BACKGROUND_SCROLL_SPEED = [0,0]
#Definição da opacidade das janelas.
WINDOW_OPACITY = 32
#Definição das Scenes que terão o sistema ativado.
WALLPAPER_SCENES = ["Scene_Menu","Scene_Item","Scene_Skill",
"Scene_Equip","Scene_Status","Scene_Party","Scene_Save","Scene_Load",
"Scene_Crafting","Scene_Conversion","Scene_Name","Scene_End","Scene_Shop",
"Scene_StatusElements","Scene_StatusStates"]
end
$imported = {} if $imported.nil?
$imported[:mog_wallpaper_ex] = true
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :wallpaper
attr_accessor :wallpaper_scroll
attr_accessor :wallpaper_window_opacity
attr_accessor :menu_particle
attr_accessor :menu_transition
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_wallpaper_initialize initialize
def initialize
mog_wallpaper_initialize
@wallpaper = "Wallpaper"
@menu_particle = ["Menu_Particles",0,3,0,1]
@wallpaper_scroll = MOG_WALLPAPER_EX::BACKGROUND_SCROLL_SPEED
@wallpaper_window_opacity = MOG_WALLPAPER_EX::WINDOW_OPACITY
@menu_transition = ["",10]
end
end
#==============================================================================
# ■ Game Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● Cursor Name
#--------------------------------------------------------------------------
def wallpaper(file_name = "",x = 0,y = 0)
$game_system.wallpaper = file_name.to_s
$game_system.wallpaper_scroll = [x,y]
end
#--------------------------------------------------------------------------
# ● Window Opacity
#--------------------------------------------------------------------------
def window_opacity(opact)
$game_system.wallpaper_window_opacity = opact
end
#--------------------------------------------------------------------------
# ● Menu Particle
#--------------------------------------------------------------------------
def menu_particle(file_name = "",x = 0,y = 3,angle = 0,blend = 1)
y = 3 if x == 0 and y == 0
$game_system.menu_particle = [file_name,x,y,angle,blend]
end
#--------------------------------------------------------------------------
# ● Menu transition
#--------------------------------------------------------------------------
def menu_transition(file_name,time = 10)
$game_system.menu_transition = [file_name.to_s,time]
end
end
#==============================================================================
# ■ Menu Particles
#==============================================================================
class Menu_Particles < Sprite
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil)
super(viewport)
self.bitmap = Cache.system($game_system.menu_particle[0].to_s)
@cw = self.bitmap.width ; @ch = self.bitmap.height
@limit1 = [@cw + (@cw / 2),@ch + (@ch / 2)]
@limit2 = [Graphics.width + @limit1[0], Graphics.height + @limit1[1]]
self.z = 5 ; reset_setting(true)
end
#--------------------------------------------------------------------------
# ● Reset Setting
#--------------------------------------------------------------------------
def reset_setting(start)
zoom = (50 + rand(75)) / 100.1
self.zoom_x = zoom ; self.zoom_y = zoom ; self.x = rand(Graphics.width)
if start
self.y = rand(Graphics.height + self.bitmap.height)
else
self.y = Graphics.height + rand(32 + self.bitmap.height)
end
self.opacity = 0
self.blend_type = $game_system.menu_particle[4]
$game_system.menu_particle[0]
if $game_system.menu_particle[1] != 0
@speed_x = [[rand($game_system.menu_particle[1]), 20].min, 1].max
else
@speed_x = 0
end
if $game_system.menu_particle[2] != 0
@speed_y = [[rand($game_system.menu_particle[2]), 20].min, 1].max
else
@speed_y = 0
end
if $game_system.menu_particle[3] != 0
@speed_a = [[rand($game_system.menu_particle[3]), 20].min, 1].max
else
@speed_a = 0
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
super
self.bitmap.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
self.x += @speed_x ; self.y -= @speed_y ; self.angle += @speed_a
self.opacity += 5 ; reset_setting(false) if can_reset?
end
#--------------------------------------------------------------------------
# ● Can Reset?
#--------------------------------------------------------------------------
def can_reset?
return true if !self.x.between?(-@limit1[0],@limit2[0])
return true if !self.y.between?(-@limit1[1],@limit2[1])
return false
end
end
#==============================================================================
# ● Scene MenuBase
#==============================================================================
class Scene_MenuBase < Scene_Base
include MOG_WALLPAPER_EX
#--------------------------------------------------------------------------
# ● Transition Name
#--------------------------------------------------------------------------
def transition_name
if $game_system.menu_transition[0] == nil or
$game_system.menu_transition[0] == ""
return ""
end
return "Graphics/System/" + $game_system.menu_transition[0].to_s
end
#--------------------------------------------------------------------------
# ● Perform Transition
#--------------------------------------------------------------------------
def perform_transition
Graphics.transition(transition_speed,transition_name)
end
#--------------------------------------------------------------------------
# ● Transition Speed
#--------------------------------------------------------------------------
def transition_speed
return $game_system.menu_transition[1]
end
#--------------------------------------------------------------------------
# ● Can Create Wallpaper
#--------------------------------------------------------------------------
def can_create_wallpaper?
return false if !WALLPAPER_SCENES.include?(SceneManager.scene.class.to_s)
return true
end
#--------------------------------------------------------------------------
# ● Pos Start
#--------------------------------------------------------------------------
alias mog_wallpaper_ex_post_start post_start
def post_start
set_window_opacity if can_create_wallpaper?
mog_wallpaper_ex_post_start
end
#--------------------------------------------------------------------------
# ● Set Window OPACITY
#--------------------------------------------------------------------------
def set_window_opacity
instance_variables.each do |varname|
ivar = instance_variable_get(varname)
if ivar != nil and ivar.is_a?(Window)
ivar.opacity = $game_system.wallpaper_window_opacity if !ivar.disposed?
end
end
end
#--------------------------------------------------------------------------
# ● Create Background
#--------------------------------------------------------------------------
alias mog_wallpaper_ex_create_background create_background
def create_background
mog_wallpaper_ex_create_background
(create_wallpaper ; create_particles) if can_create_wallpaper?
end
#--------------------------------------------------------------------------
# ● Create Wallpaper
#--------------------------------------------------------------------------
def create_wallpaper
return if @wallpaper != nil
@wallpaper_scroll_speed = 0 ; @wallpaper = Plane.new
@wallpaper.bitmap = Cache.system($game_system.wallpaper) rescue nil
@wallpaper.z = @background_sprite.z + 1
end
#--------------------------------------------------------------------------
# ● Create Particles
#--------------------------------------------------------------------------
def create_particles
return unless PARTICLES
dispose_menu_particles
range = [Graphics.width + 32, Graphics.height + 32]
@particle_viewport = Viewport.new(-32, -32, range[0], range[1])
@particle_viewport.z = 5
@particle_bitmap = []
for i in 0...NUMBER_OF_PARTICLES
@particle_bitmap.push(Menu_Particles.new(@particle_viewport))
end
end
#--------------------------------------------------------------------------
# ● Dispose Background
#--------------------------------------------------------------------------
alias mog_wallpaper_ex_dispose_background dispose_background
def dispose_background
dispose_menu_particles ; dispose_wallpaper
mog_wallpaper_ex_dispose_background
end
#--------------------------------------------------------------------------
# ● Dispose Wallpaper
#--------------------------------------------------------------------------
def dispose_wallpaper
return if @wallpaper == nil
@wallpaper.dispose ; @wallpaper = nil
end
#--------------------------------------------------------------------------
# ● Dispose Light
#--------------------------------------------------------------------------
def dispose_menu_particles
return if !PARTICLES
return if @particle_bitmap == nil
@particle_bitmap.each {|sprite| sprite.dispose}
@particle_viewport.dispose ; @particle_bitmap = nil
end
#--------------------------------------------------------------------------
# ● Update Basic
#--------------------------------------------------------------------------
alias mog_wallpaper_ex_update_basic update_basic
def update_basic
mog_wallpaper_ex_update_basic
update_wallpaper_ex
end
#--------------------------------------------------------------------------
# ● Update Wallpaper EX
#--------------------------------------------------------------------------
def update_wallpaper_ex
update_wallpaper ; update_particle
end
#--------------------------------------------------------------------------
# ● Update Background
#--------------------------------------------------------------------------
def update_wallpaper
return if @wallpaper == nil
@wallpaper_scroll_speed += 1
return if @wallpaper_scroll_speed < 2
@wallpaper_scroll_speed = 0
@wallpaper.ox += $game_system.wallpaper_scroll[0]
@wallpaper.oy += $game_system.wallpaper_scroll[1]
end
#--------------------------------------------------------------------------
# ● Update Particle
#--------------------------------------------------------------------------
def update_particle
return if @particle_bitmap == nil
@particle_bitmap.each {|sprite| sprite.update }
end
end
Celui du craft ici :
- Code:
#Advanced Recipe Crafting v1.0b
#----------#
#Features: Advanced Recipe crafting! Hold on tight!
#
#Usage: Set up your recipes, learn recipes, make items! Yay!
# $crafting_category = :craft - call before Scene, craft is category
# SceneManager.call(Scene_Crafting) - opens the Crafting menu
# SceneManager.call(Scene_CraftingAll)- opens the category Crafting menu
# learn_recipe(id) - teaches that recipe
# forget_recipe(id) - forgets that recipe
#
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
# given by email: sumptuaryspade@live.ca
# provided on facebook: http://www.facebook.com/DaimoniousTailsGames
# All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
#
#- Free to use in any project with credit given, donations always welcome!
module ADV_RECIPE
#Whether or not crafted items use Weapon/Armor Randomization
USE_WA_RANDOMIZATION = false
#The names of the categories for All Crafting Menu, use :All for all recipes
CATEGORIES = [:Alchimie,:Forge,:Tisserand,:Armurier]
#The icons for categories, same order as above
CATEGORY_ICONS = [10,199,284,332]
#The icon for player level
LEVEL_ICON = 117
#Xp needed for crafting level, lvl is used for current level
XP_NEEDED_EQUATION = "100 * lvl"
#Allow the crafting of multiple items
CRAFT_MULTIPLE = false
#Allow or disallow menu access to the crafting scene
ENABLE_MENU_ACCESS = false
#Font Size of Detail window, smaller font size creates more room for materials
DETAIL_FONT_SIZE = 18
#The following options disable the display of certain features. They still work
# however if declared in recipes, so edit recipes accordingly.
#Removes Gold Cost
DISABLE_GOLD_COST = false
#Removes success rate
DISABLE_SUCCESS = false
#Removes player level requirement
DISABLE_PLAYER_LEVEL = false
#Removes crafting level requirement and gauge
DISABLE_CRAFT_LEVEL = false
#Auto-learn all skills (can use forget_recipe to forget certain ones for later)
AUTO_LEARN_RECIPES = true
#The fun (read: complicated) part!
#Recipe symbols:
#
#The crafted item, type is 0 for item, 1 for weapon, 2 for armor
# :result => [type,id,amount]
#
#The materials required, same style as result.
# :materials => [ [type,id,amount],[type,id,amount] ... ],
#
# All the following are optional:
# :gold_cost => amount - amount of gold to craft, can be 0
# :success => percent - base percent chance of successful craft
# :success_gain => percent - percent gain on success per crafting level
# :level => value - Hero level required to craft
# :craft_level => value - Crafting level required to craft
# :category => :category - Crafting category (:Alchemy, :Tailor, etc)
# :multiple => false - disallows multiple crafts
# :xp => amount - base Crafting xp gained per craft
# :xp_deprac => amount - Xp lost per crafting level
# :pxp => amount - Player xp gainer per craft
# Formula for xp gained is as follows and is never negative:
# xp gain = xp - (current_level - recipe_level) * xp_deprac
RECIPES = {
0 => { :result => [0,2,1],
:materials => [[0,1,5]],
:gold_cost => [50,"Cuivre"],
:success => 100,
:level => 1,
:craft_level => 1,
:category => :Alchimie,
:xp => 5,},
1 => { :result => [0,3,1],
:materials => [[0,2,5]],
:gold_cost => [5,"Argent"],
:success => 90,
:level => 1,
:craft_level => 1,
:category => :Alchimie,
:xp => 10,},
2 => { :result => [0,7,1],
:materials => [[0,2,3],[0,5,2],[0,6,2]],
:gold_cost => [10,"Argent"],
:success => 85,
:level => 1,
:craft_level => 1,
:category => :Alchimie,
:xp => 20,},
3 => { :result => [0,8,1],
:materials => [[0,3,1],[0,4,2],[0,7,1]],
:gold_cost => [5,"Or"],
:success => 80,
:level => 1,
:craft_level => 1,
:category => :Alchimie,
:xp => 50,},
4 => { :result => [1,2,1],
:materials => [[1,1,1],[0,32,1],[0,33,1]],
:gold_cost => [500,"Cuivre"],
:success => 95,
:level => 1,
:craft_level => 1,
:category => :Forge,
:xp => 50,},
5 => { :result => [2,1,1],
:materials => [[0,34,1]],
:gold_cost => [50,"Cuivre"],
:success => 100,
:level => 1,
:craft_level => 1,
:category => :Tisserand,
:xp => 10,},
6 => { :result => [2,32,1],
:materials => [[0,35,1]],
:gold_cost => [1500,"Cuivre"],
:success => 100,
:level => 1,
:craft_level => 1,
:category => :Armurier,
:xp => 10,},
}
end
$crafting_category = :All
class Recipe
attr_accessor :result
attr_accessor :materials
attr_accessor :known
attr_accessor :id
attr_accessor :gold_cost
attr_accessor :level
attr_accessor :category
attr_accessor :xp
def initialize(id,recipe_hash)
@id = id
@result = Material.new(recipe_hash[:result])
@materials = []
for item in recipe_hash[:materials]
@materials.push(Material.new(item))
end
@known = false
recipe_hash[:gold_cost] ? @gold_cost = recipe_hash[:gold_cost] : @gold_cost = 0
recipe_hash[:success] ? @rate = recipe_hash[:success] : @rate = 100
recipe_hash[:success_gain] ? @rated = recipe_hash[:success_gain] : @rated = 0
recipe_hash[:level] ? @level = recipe_hash[:level] : @level = 1
recipe_hash[:category] ? @category = recipe_hash[:category] : @category = CATEGORIES[0]
recipe_hash[:xp] ? @xp = recipe_hash[:xp] : @xp = 0
recipe_hash[:xp_deprac] ? @xpd = recipe_hash[:xp_deprac] : @xpd = 0
recipe_hash[:craft_level] ? @clevel = recipe_hash[:craft_level] : @clevel = 0
recipe_hash[:pxp] ? @pxp = recipe_hash[:pxp] : @pxp = 0
!recipe_hash[:multiple].nil? ? @mult = recipe_hash[:multiple] : @mult = true
@known = ADV_RECIPE::AUTO_LEARN_RECIPES
end
def name
return @result.item.name
end
def multiple?
@mult
end
def has_materials?
for item in @materials
return false unless $game_party.item_number(item.item) >= item.amount
end
return true
end
def has_gold?
$game_party.gold >= @gold_cost
end
def has_craft_level?
craft_level <= $game_party.craft_level_sym(@category)
end
def has_level?
@level <= $game_party.highest_level && has_craft_level?
end
def craftable?
has_gold? && has_materials? && has_level?
end
def craft_level
@clevel
end
def amount_craftable?
mat_amount = []
for item in @materials
mat_amount.push($game_party.item_number(item.item) / item.amount)
end
if @gold_cost > 0
return [$game_party.gold / @gold_cost,mat_amount.min].min
else
return mat_amount.min
end
end
def craft(fail = 0)
remove_materials
if fail < success_rate
return add_result
else
return nil
end
end
def remove_materials
for item in @materials
$game_party.gain_item(item.item,-item.amount)
end
$game_party.gain_gold(-@gold_cost)
end
def add_result
if ADV_RECIPE::USE_WA_RANDOMIZATION
item = $game_party.add_weapon(@result.item.id,@result.amount) if @result.item.is_a?(RPG::Weapon)
item = $game_party.add_armor(@result.item.id,@result.amount) if @result.item.is_a?(RPG::Armor)
item = $game_party.add_item(@result.item.id,@result.amount) if @result.item.is_a?(RPG::Item)
else
$game_party.gain_item(@result.item,@result.amount)
item = @result.item
end
$game_party.gain_craft_exp(category_id, xp_gain)
$game_party.members.each do |actor|
actor.gain_exp(@pxp)
end
item
end
def category_id
ADV_RECIPE::CATEGORIES.index(@category)
end
def xp_gain
level_diff = $game_party.craft_level(category_id) - @clevel
[@xp - @xpd * level_diff,0].max
end
def success_rate
level_diff = $game_party.craft_level(category_id) - @clevel
[@rate + @rated * level_diff,100].min
end
end
class Material
attr_accessor :item
attr_accessor :amount
def initialize(mat)
@item = $data_items[mat[1]] if mat[0] == 0
@item = $data_weapons[mat[1]] if mat[0] == 1
@item = $data_armors[mat[1]] if mat[0] == 2
@amount = mat[2]
end
end
class Game_Party
alias recipe_init initialize
def initialize
recipe_init
@crafting_level = [1]*ADV_RECIPE::CATEGORIES.size
@craft_exp = [0]*ADV_RECIPE::CATEGORIES.size
end
def craft_level(id)
@crafting_level[id]
end
def craft_level_sym(sym)
@crafting_level[ADV_RECIPE::CATEGORIES.index(sym)]
end
def craft_exp(id)
@craft_exp[id]
end
def craft_exp_next(id)
lvl = craft_level(id)
return eval(ADV_RECIPE::XP_NEEDED_EQUATION)
end
def gain_craft_exp(id, val)
@craft_exp[id] += val
while craft_exp(id) >= craft_exp_next(id)
@craft_exp[id] -= craft_exp_next(id)
@crafting_level[id] += 1
end
end
end
module DataManager
class << self
alias rec_cgo create_game_objects
alias rec_msc make_save_contents
alias rec_esc extract_save_contents
end
def self.create_game_objects
rec_cgo
$game_recipes = create_recipes
end
def self.make_save_contents
contents = rec_msc
contents[:recipe] = $game_recipes
contents
end
def self.extract_save_contents(contents)
rec_esc(contents)
$game_recipes = contents[:recipe]
end
def self.create_recipes
recipes = {}
ADV_RECIPE::RECIPES.each_pair do |key, val|
recipes[key] = Recipe.new(key,val)
end
recipes
end
end
class Game_Interpreter
def learn_recipe(id)
return if $game_recipes[id].nil?
$game_recipes[id].known = true
end
def forget_recipe(id)
return if $game_recipes[id].nil?
$game_recipes[id].known = false
end
end
class Window_RecipeList < Window_Selectable
def initialize(x,y,w,h)
super
@data = $game_recipes.values.select {|recipe| include?(recipe)}
refresh
end
def item_max
@data ? @data.size : 1
end
def item
@data && index >= 0 ? @data[index] : nil
end
def current_item_enabled?
enable?(@data[index])
end
def include?(item)
return false unless item.has_craft_level?
return false unless item.known
return true if @category == :All
return @category == item.category
end
def set_category(cat)
return if cat == @category
@category = cat
@data = $game_recipes.values.select {|recipe| include?(recipe)}
refresh
end
def enable?(item)
return false if item.nil?
item.craftable?
end
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item.result.item, rect.x, rect.y, enable?(item))
if item.amount_craftable? > 0
draw_text(rect.x,rect.y,contents.width,24,"x"+item.amount_craftable?.to_s,2)
end
end
end
def current_item
index >= 0 ? @data[index] : nil
end
def process_ok
if current_item_enabled?
Sound.play_ok
Input.update
call_ok_handler
else
Sound.play_buzzer
end
end
def refresh
create_contents
super
end
def content_heights
item_max * 24
end
end
class Window_RecipeDetail < Window_Base
def initialize(x,y,w,h)
super
@recipe = nil
end
def set_recipe(recipe)
@recipe = recipe
refresh
end
def refresh
contents.clear
contents.font.size = ADV_RECIPE::DETAIL_FONT_SIZE
return if @recipe.nil?
draw_craft_level unless ADV_RECIPE::DISABLE_PLAYER_LEVEL && ADV_RECIPE::DISABLE_CRAFT_LEVEL
draw_materials
draw_success_rate unless ADV_RECIPE::DISABLE_SUCCESS
draw_gold_cost unless ADV_RECIPE::DISABLE_GOLD_COST
end
def draw_craft_level
change_color(system_color, @recipe.has_level?)
draw_text(0,0,contents.width,contents.font.size,"Niveaux requis :")
change_color(normal_color, @recipe.has_level?)
xx = 0
if !ADV_RECIPE::DISABLE_PLAYER_LEVEL
draw_text(0,0,contents.width,contents.font.size,@recipe.level,2)
draw_icon(ADV_RECIPE::LEVEL_ICON,contents.width - 48,0)
xx += 48
text = @recipe.craft_level.to_s + "/"
else
text = @recipe.craft_level.to_s
end
if !ADV_RECIPE::DISABLE_CRAFT_LEVEL
draw_text(0,0,contents.width - xx,contents.font.size,text,2)
draw_icon(ADV_RECIPE::CATEGORY_ICONS[ADV_RECIPE::CATEGORIES.index(@recipe.category)],contents.width - 56 - xx,0)
end
end
def draw_materials
if ADV_RECIPE::DISABLE_CRAFT_LEVEL && ADV_RECIPE::DISABLE_PLAYER_LEVEL
yy = 0
else
yy = contents.font.size
end
change_color(system_color, @recipe.craftable?)
draw_text(0,yy,self.width,contents.font.size,"Ingrédients requis :")
yy += contents.font.size
for item in @recipe.materials
change_color(normal_color, $game_party.item_number(item.item) >= item.amount)
draw_icon(item.item.icon_index,0,yy)
draw_text(24,yy,self.width,contents.font.size,item.item.name)
string = $game_party.item_number(item.item).to_s + "/" + item.amount.to_s
draw_text(0,yy,self.contents.width,contents.font.size,string,2)
yy += contents.font.size
end
end
def draw_success_rate
change_color(system_color, @recipe.craftable?)
draw_text(0,contents.height-contents.font.size,contents.width,contents.font.size,"Taux de réussite :")
change_color(normal_color, @recipe.craftable?)
draw_text(0,contents.height-contents.font.size,contents.width,contents.font.size,@recipe.success_rate.to_s + "%",2)
end
def draw_gold_cost
if @recipe.gold_cost > 0
change_color(system_color, @recipe.has_gold?)
draw_text(0,contents.height-contents.font.size*2,contents.width,contents.font.size,"Coût de production :")
change_color(normal_color, @recipe.has_gold?)
draw_currency_value(@recipe.gold_cost,Vocab::currency_unit,0,contents.height-contents.font.size*2,contents.width)
end
end
def draw_currency_value(value, unit, x, y, width)
cx = text_size(unit).width
change_color(normal_color,$game_party.gold >= value)
draw_text(x, y, width - cx - 2, contents.font.size, value, 2)
change_color(system_color)
draw_text(x, y, width, contents.font.size, unit, 2)
end
end
class Window_RecipeConfirm < Window_Selectable
attr_accessor :amount
def initialize(x,y,w,h)
super
@amount = 1
refresh
end
def item_max; 1; end;
def enable?(item); true; end;
def refresh
super
draw_text(0,0,self.contents.width,line_height,"Produire",1)
return unless @recipe && @recipe.craftable?
draw_text(0,0,contents.width,line_height,"x"+@amount.to_s,2)
end
def activate
super
select(0)
end
def deactivate
super
select(-1)
end
def set_recipe(rec)
return if rec == @recipe
@recipe = rec
@amount = 1
refresh
end
def cursor_movable?
active && open? && ADV_RECIPE::CRAFT_MULTIPLE && @recipe.multiple?
end
def cursor_down(wrap = false)
change_amount(-10)
end
def cursor_up(wrap = false)
change_amount(10)
end
def cursor_right(wrap = false)
change_amount(1)
end
def cursor_left(wrap = false)
change_amount(-1)
end
def change_amount(val)
Sound.play_cursor
@amount += val
@amount = [[@amount,1].max,@recipe.amount_craftable?].min
refresh
end
end
class Scene_CraftingAll < Scene_Base
def start
super
@help_window = Window_Help.new
width = Graphics.width / 2
height = Graphics.height - @help_window.height - 48
@list_window = Window_RecipeList.new(0,@help_window.height+48,width,height-48)
@list_window.set_handler(:ok, method(:list_success))
@list_window.set_handler(:cancel, method(:cancel))
@list_window.height += 48 if ADV_RECIPE::DISABLE_CRAFT_LEVEL
@list_window.create_contents
@detail_window = Window_RecipeDetail.new(width,@list_window.y,width,height-48*2)
@detail_window.height += 48 if ADV_RECIPE::DISABLE_GOLD_COST
@detail_window.create_contents
height = @detail_window.y + @detail_window.height
@confirm_window = Window_RecipeConfirm.new(width,height,width,48)
@confirm_window.set_handler(:ok, method(:craft_success))
@confirm_window.set_handler(:cancel, method(:confirm_cancel))
if !ADV_RECIPE::DISABLE_GOLD_COST
@gold_window = Window_Gold.new
@gold_window.width = width
@gold_window.y = Graphics.height - 48
@gold_window.x = width
end
@popup_window = Window_RecPopup.new
@popup_window.set_handler(:ok, method(:popup_ok))
@popup_window.set_handler(:cancel, method(:popup_ok))
@command_window = Window_RecCategory.new
@command_window.set_handler(:ok, method(:command_ok))
@command_window.set_handler(:cancel, method(:command_cancel))
@gauge_window = Window_RecGauge.new unless ADV_RECIPE::DISABLE_CRAFT_LEVEL
end
def popup_ok
@popup_window.deactivate
@popup_window.close
@list_window.activate
end
def update
super
@help_window.set_text(@list_window.current_item.result.item.description) if !@list_window.current_item.nil?
@detail_window.set_recipe(@list_window.current_item)
@confirm_window.set_recipe(@list_window.current_item)
@list_window.set_category(ADV_RECIPE::CATEGORIES[@command_window.index])
@gauge_window.set_category(ADV_RECIPE::CATEGORIES[@command_window.index]) unless ADV_RECIPE::DISABLE_CRAFT_LEVEL
return unless @list_window.current_item
if @list_window.current_item.craftable?
@confirm_window.opacity = 255
@confirm_window.contents_opacity = 255
else
@confirm_window.opacity = 75
@confirm_window.contents_opacity = 75
end
end
def list_success
@list_window.deactivate
@confirm_window.activate
end
def craft_success
amount = 0
item = nil
@confirm_window.amount.times do
item2 = @list_window.current_item.craft(rand(100))
if item2
amount += 1
item = item2
end
end
if item
@popup_window.set_text(item, amount)
else
@popup_window.set_text_fail
end
@confirm_window.change_amount(-1000)
@gold_window.refresh unless ADV_RECIPE::DISABLE_GOLD_COST
@list_window.refresh
@gauge_window.refresh unless ADV_RECIPE::DISABLE_CRAFT_LEVEL
@popup_window.activate
end
def confirm_cancel
@confirm_window.deactivate
@list_window.activate
end
def command_cancel
SceneManager.return
end
def cancel
@list_window.select(-1)
@command_window.activate
end
def command_ok
@list_window.select(0)
@list_window.activate
end
end
class Scene_Crafting < Scene_CraftingAll
def start
super
@command_window.index = ADV_RECIPE::CATEGORIES.index($crafting_category)
@command_window.deactivate
@command_window.visible = false
@list_window.height += 48
@list_window.y -= 48
@detail_window.height += 48
@detail_window.y -= 48
@list_window.create_contents
@detail_window.create_contents
@list_window.select(0)
@list_window.activate
end
def cancel
SceneManager.return
end
end
class Window_RecCategory < Window_HorzCommand
def initialize
super(0,72)
end
def window_width; Graphics.width; end
def window_height; 48; end
def make_command_list
ADV_RECIPE::CATEGORIES.each do |command|
add_command(command.to_s,command)
end
end
def item_width
120
end
def draw_item(index)
change_color(normal_color, command_enabled?(index))
rect = item_rect_for_text(index)
draw_text(rect, command_name(index))
draw_icon(ADV_RECIPE::CATEGORY_ICONS[index],rect.x-24,rect.y)
end
def item_rect_for_text(index)
rect = item_rect(index)
rect.x += 28
rect.width -= 28
rect
end
end
class Window_RecPopup < Window_Selectable
def initialize
super(Graphics.width/2-window_width/2,Graphics.height/2-window_height/2,120,48)
self.openness = 0
deactivate
end
def window_width; 120; end
def window_height; 48; end
def set_text(item, amount)
contents.clear
text = amount.to_s + "x " + item.name + " - Production réussie !"
width = contents.text_size(text).width
self.width = width + padding*2
self.x = Graphics.width/2-width/2
create_contents
draw_text(24,0,contents.width,line_height,text)
draw_icon(item.icon_index,0,0)
open
end
def set_text_fail
contents.clear
text = "Echec !"
width = contents.text_size(text).width
self.width = width + padding*2
self.x = Graphics.width/2-width/2
create_contents
draw_text(12,0,contents.width,line_height,text)
open
end
def process_ok
if current_item_enabled?
Input.update
deactivate
call_ok_handler
else
Sound.play_buzzer
end
end
end
class Window_RecGauge < Window_Base
def initialize
super(0,Graphics.height-48,Graphics.width/2,48)
@category = :All
end
def refresh
contents.clear
return if @category == :All
draw_icon(ADV_RECIPE::CATEGORY_ICONS[cat_index],0,0)
draw_text(24,0,contents.width,24,$game_party.craft_level(cat_index))
rate = $game_party.craft_exp(cat_index).to_f / $game_party.craft_exp_next(cat_index)
draw_gauge(48, -3, contents.width-48, rate, tp_gauge_color1, tp_gauge_color2)
if Module.const_defined?(:SPECIAL_GAUGES)
@gauges[[48,-3]].set_extra("XP",$game_party.craft_exp(cat_index),$game_party.craft_exp_next(cat_index))
else
text = $game_party.craft_exp(cat_index).to_s+"/"+$game_party.craft_exp_next(cat_index).to_s
draw_text(0,0,contents.width,24,text,2)
end
end
def set_category(cat)
return if cat == @category
@category = cat
refresh
end
def cat_index
ADV_RECIPE::CATEGORIES.index(@category)
end
end
class Window_MenuCommand < Window_Command
alias recipe_aoc add_original_commands
def add_original_commands
recipe_aoc
add_command("Crafting", :recipe) if ADV_RECIPE::ENABLE_MENU_ACCESS
end
end
class Scene_Menu < Scene_MenuBase
alias recipe_create_command_window create_command_window
def create_command_window
recipe_create_command_window
@command_window.set_handler(:recipe, method(:command_recipe))
end
def command_recipe
SceneManager.call(Scene_CraftingAll)
end
end
- ZouzakaMembre
- Nombre de messages : 302
Age : 25
Distinction : aucune
Date d'inscription : 25/12/2011
Re: Wallpaper
Dim 10 Mai 2015 - 13:11
Cherche cette ligne :
- Code:
class Scene_CraftingAll < Scene_Base
- Code:
class Scene_CraftingAll < Scene_MenuBase
- NérylisMembre
- Nombre de messages : 615
Age : 35
Localisation : Seine Maritime
Distinction : aucune
Date d'inscription : 23/11/2014
Re: Wallpaper
Dim 10 Mai 2015 - 13:30
Impeccable, ça marche. merci bien.
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|