Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ╔═══════════════════════════════════════════════╦════════════════════╗
- # ║ Title: Spell Charge System Shop ║ Version: 1.01 ║
- # ║ Author: Roninator2 ║ ║
- # ╠═══════════════════════════════════════════════╬════════════════════╣
- # ║ Function: ║ Date Created ║
- # ║ ╠════════════════════╣
- # ║ Purchase Spells ║ 12 Feb 2024 ║
- # ╚═══════════════════════════════════════════════╩════════════════════╝
- # ╔════════════════════════════════════════════════════════════════════╗
- # ║ Requires: Spell Charge System Base ║
- # ╚════════════════════════════════════════════════════════════════════╝
- # ╔════════════════════════════════════════════════════════════════════╗
- # ║ Brief Description: ║
- # ║ Allows to buy spells like Final Fantasy 1 ║
- # ╚════════════════════════════════════════════════════════════════════╝
- # ╔════════════════════════════════════════════════════════════════════╗
- # ║ Instructions: ║
- # ║ Shop Setup: ║
- # ║ ║
- # ║ To create a skill shop, you'll need to do a script call ║
- # ║ Step 1. Under the event commands, choose tab 3 ║
- # ║ then under advanced choose Script. ║
- # ║ Step 2. In the script window, you'll need to enter ║
- # ║ ║
- # ║ goods = [35,36,37,38] ║
- # ║ shop = "White Magic" ║
- # ║ SceneManager.call(Scene_Spell_Shop) ║
- # ║ SceneManager.scene.prepare(goods, shop) ║
- # ║ ║
- # ║ Description of goods ║
- # ║ goods = [3, 4, 5, 6] <= skill id numbers ║
- # ║ ║
- # ║ ║
- # ╚════════════════════════════════════════════════════════════════════╝
- # ╔════════════════════════════════════════════════════════════════════╗
- # ║ Updates: ║
- # ║ 1.00 - 12 Feb 2024 - Script finished ║
- # ║ 1.01 - 29 Jul 2024 - Fixed documentation ║
- # ╚════════════════════════════════════════════════════════════════════╝
- # ╔════════════════════════════════════════════════════════════════════╗
- # ║ Credits and Thanks: ║
- # ║ Roninator2 ║
- # ║ ║
- # ╚════════════════════════════════════════════════════════════════════╝
- # ╔════════════════════════════════════════════════════════════════════╗
- # ║ Terms of use: ║
- # ║ Follow the original Authors terms of use where applicable ║
- # ║ - When not made by me (Roninator2) ║
- # ║ Free for all uses in RPG Maker except nudity ║
- # ║ Anyone using this script in their project before these terms ║
- # ║ were changed are allowed to use this script even if it conflicts ║
- # ║ with these new terms. New terms effective 03 Apr 2024 ║
- # ║ No part of this code can be used with AI programs or tools ║
- # ║ Credit must be given ║
- # ╚════════════════════════════════════════════════════════════════════╝
- #==============================================================================
- # ** Vocab
- #==============================================================================
- module Vocab
- # Spell Shop Screen
- Spell_Buy = "Buy"
- Spell_Cancel = "Exit"
- Shop_Title = "Welcome to my Magic Shop"
- Not_Usable = "This cannot be used by you"
- Spells_Full = "Your spells are full"
- Spell_Owned = "You already have this spell"
- end
- #==============================================================================
- # ** Spell Charge
- #==============================================================================
- module Spell_Charge
- #==============================================================================
- # ** Shop Options
- #==============================================================================
- module Shop
- # maximum number of party members in Image Window
- MAX_PARTY = 4
- end
- module Options
- # time to wait before message window disappears
- # this window is for messages regading purchases are not possible
- MESSAGE_WAIT = 160
- end
- #==============================================================================
- # ** Spell Settings
- #==============================================================================
- module Spell
- # ╔══════════════════════════════════════════════════════════╗
- # ║ Instructions: ║
- # ║ ║
- # ║ Note tags ║
- # ║ Skills ║
- # ║ <spell cost: 100> ║
- # ║ Will make the spell cost 100 gold to buy ║
- # ║ ║
- # ╚══════════════════════════════════════════════════════════╝
- # Skill notetag
- # <spell cost: 100> # specify the cost to buy the skill
- SPELL_COST = /<spell[ -_]cost:[ -_](\d+)>/i
- end
- end
- # ╔══════════════════════════════════════════════════════════╗
- # ║ End of Editable section ║
- # ╚══════════════════════════════════════════════════════════╝
- #==============================================================================
- # ** Window_Spell_Group
- #==============================================================================
- class Window_Spell_Group < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, window_width, window_height)
- @text = ""
- end
- #--------------------------------------------------------------------------
- # * Set Text
- #--------------------------------------------------------------------------
- def group(text)
- if text != @text
- @text = text.to_s
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # * window_width
- #--------------------------------------------------------------------------
- def window_width
- 160
- end
- #--------------------------------------------------------------------------
- # * window_height
- #--------------------------------------------------------------------------
- def window_height
- fitting_height(1)
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_text_ex(4, 0, @text)
- end
- end
- #==============================================================================
- # ** Window_Spell_Title
- #==============================================================================
- class Window_Spell_Title < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(line_number = 1)
- super(0, 0, Graphics.width - 160, fitting_height(line_number))
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- text = Vocab::Shop_Title
- draw_text(0, 0, contents.width, 24, text, 1)
- end
- end
- #==============================================================================
- # ** Window_Spell_Message
- #==============================================================================
- class Window_Spell_Message < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(line_number = 1)
- @text = ""
- super(Graphics.width / 4, Graphics.height / 2, window_width, fitting_height(line_number))
- @timer = -1
- refresh
- end
- #--------------------------------------------------------------------------
- # * Window Width
- #--------------------------------------------------------------------------
- def window_width
- @text.size * 12
- end
- #--------------------------------------------------------------------------
- # * Set Text
- #--------------------------------------------------------------------------
- def set_text(text)
- if text != @text
- @text = text
- @timer = 0
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # * Clear
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- refresh
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- def update
- super
- @timer += 1 if @timer >= 0
- if @timer >= Spell_Charge::Options::MESSAGE_WAIT
- set_text("")
- self.hide
- @timer = -1
- end
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.width = window_width
- contents.clear
- contents.dispose
- create_contents
- draw_text_ex(4, 0, @text)
- end
- end
- #==============================================================================
- # ** Window_Spell_Help
- #==============================================================================
- class Window_Spell_Help < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(line_number = 1)
- super(0, 0, Graphics.width, fitting_height(line_number))
- end
- #--------------------------------------------------------------------------
- # * Set Text
- #--------------------------------------------------------------------------
- def set_text(text)
- if text != @text
- @text = text
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # * Clear
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # * Set Item
- # item : Skills and items etc.
- #--------------------------------------------------------------------------
- def set_item(item)
- set_text(item ? item.description : "")
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_text_ex(4, 0, @text)
- end
- end
- #==============================================================================
- # ** Window_SpellShopCommand
- #==============================================================================
- class Window_SpellShopCommand < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(window_width)
- @window_width = window_width
- super(0, 0)
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- @window_width
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::Spell_Buy, :buy)
- add_command(Vocab::Spell_Cancel, :cancel)
- end
- end
- #==============================================================================
- # ** Window_ClassStatus
- #==============================================================================
- class Window_ClassStatus < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, wh)
- super(x, y, window_width, wh)
- @item = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- 200
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_class_use
- end
- #--------------------------------------------------------------------------
- # * Set Item
- #--------------------------------------------------------------------------
- def item=(item)
- @item = item
- refresh
- end
- #--------------------------------------------------------------------------
- # * Draw classes that can use spell
- #--------------------------------------------------------------------------
- def draw_class_use
- return if @item.nil?
- y = 0
- @item.class_learn.each do |id|
- act_cls = $data_classes[id]
- draw_text(0, y, 160, 24, act_cls.name, 1)
- y += 24
- end
- end
- end # Window_ClassStatus
- #==============================================================================
- # ** Window_SpellBuy
- #==============================================================================
- class Window_SpellBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :class_window # Status window
- attr_reader :image_window # Status window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(y, w, h, shop_goods)
- super(0, y, w, h)
- @shop_goods = shop_goods
- @money = 0
- refresh
- select(0)
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # * Get Item
- #--------------------------------------------------------------------------
- def item
- @data[index]
- end
- #--------------------------------------------------------------------------
- # * Set Party Gold
- #--------------------------------------------------------------------------
- def money=(money)
- @money = money
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Selection Item
- #--------------------------------------------------------------------------
- def current_item_enabled?
- enable?(@data[index])
- end
- #--------------------------------------------------------------------------
- # * Get Price of Item
- #--------------------------------------------------------------------------
- def price(item)
- @price[item]
- end
- #--------------------------------------------------------------------------
- # * Display in Enabled State?
- #--------------------------------------------------------------------------
- def enable?(item)
- item && price(item) <= @money
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- #--------------------------------------------------------------------------
- # * Create Item List
- #--------------------------------------------------------------------------
- def make_item_list
- @data = []
- @price = {}
- @shop_goods.each do |goods|
- item = $data_skills[goods] if goods != nil
- if item
- @data.push(item)
- @price[item] = item.spell_cost
- end
- end
- end
- #--------------------------------------------------------------------------
- # * 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
- draw_text(rect, price(item), 2)
- end
- #--------------------------------------------------------------------------
- # * Set Status Window
- #--------------------------------------------------------------------------
- def class_window=(class_window)
- @class_window = class_window
- call_update_help
- end
- #--------------------------------------------------------------------------
- # * Set Status Window
- #--------------------------------------------------------------------------
- def image_window=(image_window)
- @image_window = image_window
- call_update_help
- end
- #--------------------------------------------------------------------------
- # * Update Help Text
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item) if @help_window
- @class_window.item = item if @class_window
- @image_window.item = item if @image_window
- end
- end # Window_SpellBuy
- #==============================================================================
- # ** Window_ImageStatus
- #==============================================================================
- class Window_ImageStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @index = -1
- @walk = 0
- @page_index = 0
- @animtime = 0
- @data = []
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return page_size
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # * Set Item
- #--------------------------------------------------------------------------
- def item=(item)
- @item = item
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- return if @item.nil?
- make_actor_list
- page_size.times do |i|
- draw_party(i)
- end
- end
- #--------------------------------------------------------------------------
- # * Create Actor List
- #--------------------------------------------------------------------------
- def make_actor_list
- @data = status_members
- end
- #--------------------------------------------------------------------------
- # * Draw Quantity Possessed
- #--------------------------------------------------------------------------
- def draw_party(i)
- x = i * (item_width + spacing) + 84
- rect = Rect.new(x, 40, 48, 48)
- return if @data[i].nil?
- draw_actor_graphic(@data[i], rect.x, rect.y, @data[i].skill_purchase?(@item))
- end
- #--------------------------------------------------------------------------
- # * Get Spacing for Items Arranged Side by Side
- #--------------------------------------------------------------------------
- def spacing
- return Graphics.width / page_size - item_width - page_size * 4
- end
- #--------------------------------------------------------------------------
- # * Number of Actors Displayable at Once
- #--------------------------------------------------------------------------
- def page_size
- return Spell_Charge::Shop::MAX_PARTY
- end
- #--------------------------------------------------------------------------
- # * Calculate Width of Window Contents
- #--------------------------------------------------------------------------
- def contents_width
- Graphics.width - standard_padding * 2
- end
- #--------------------------------------------------------------------------
- # * Get Maximum Number of Pages
- #--------------------------------------------------------------------------
- def page_max
- ($game_party.members.size + page_size - 1) / page_size
- end
- #--------------------------------------------------------------------------
- # * Array of Actors for Which to Draw Equipment Information
- #--------------------------------------------------------------------------
- def status_members
- $game_party.members[@page_index * page_size, page_size]
- end
- #--------------------------------------------------------------------------
- # * Overwrite: draw_character
- #--------------------------------------------------------------------------
- def draw_character(character_name, character_index, x, y, ani = false)
- return unless character_name
- bitmap = Cache.character(character_name)
- sign = character_name[/^[\!\$]./]
- if sign && sign.include?('$')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = character_index
- step = 0
- step = @walk if ani
- src_rect = Rect.new((n%4*3+1+step)*cw, (n/4*4)*ch, cw, ch)
- contents.blt(x - cw / 2, y - ch, bitmap, src_rect, ani ? 255 : translucent_alpha)
- end
- #--------------------------------------------------------------------------
- # * Overwrite: draw_actor_graphic
- #--------------------------------------------------------------------------
- def draw_actor_graphic(actor, x, y, ani = false)
- draw_character(actor.character_name, actor.character_index, x, y, ani)
- end
- #--------------------------------------------------------------------------
- # * New Method: ani_motion
- #--------------------------------------------------------------------------
- def ani_motion
- @animtime += 1
- if @animtime == 10
- case @walk
- when 1; @walk -= 1
- when -1; @walk += 1
- when 0
- if @step == 1
- @walk = -1
- @step = 0
- else
- @walk = 1
- @step = 1
- end
- end
- refresh
- @animtime = 0
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- ani_motion
- end
- #--------------------------------------------------------------------------
- # * Update Page
- #--------------------------------------------------------------------------
- def update_page
- if visible && Input.trigger?(:A) && page_max > 1
- @page_index = (@page_index + 1) % page_max
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # * Get Item Width
- #--------------------------------------------------------------------------
- def item_width
- 48
- end
- #--------------------------------------------------------------------------
- # * Get Item Height
- #--------------------------------------------------------------------------
- def item_height
- 48
- end
- #--------------------------------------------------------------------------
- # * Calculate Height of Window Contents
- #--------------------------------------------------------------------------
- def contents_height
- item_height
- end
- #--------------------------------------------------------------------------
- # * Get Leading Digits
- #--------------------------------------------------------------------------
- def top_col
- ox / (item_width + spacing)
- end
- #--------------------------------------------------------------------------
- # * Set Leading Digits
- #--------------------------------------------------------------------------
- def top_col=(col)
- col = 0 if col < 0
- col = col_max - 1 if col > col_max - 1
- self.ox = col * (item_width + spacing)
- end
- #--------------------------------------------------------------------------
- # * Get Trailing Digits
- #--------------------------------------------------------------------------
- def bottom_col
- top_col + col_max - 1
- end
- #--------------------------------------------------------------------------
- # * Set Trailing Digits
- #--------------------------------------------------------------------------
- def bottom_col=(col)
- self.top_col = col - (col_max - 1)
- end
- #--------------------------------------------------------------------------
- # * Scroll Cursor to Position Within Screen
- #--------------------------------------------------------------------------
- def ensure_cursor_visible
- self.top_col = index if index < top_col
- self.bottom_col = index if index > bottom_col
- end
- #--------------------------------------------------------------------------
- # * Get Rectangle for Displaying Items
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = super
- rect.x = index * (item_width + spacing) + 60
- rect.y = 0
- rect
- end
- #--------------------------------------------------------------------------
- # * Get Alignment
- #--------------------------------------------------------------------------
- def alignment
- return 1
- end
- end # Window_ImageStatus
- #==============================================================================
- # ** Spell_Shop
- #==============================================================================
- class Scene_Spell_Shop < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * Prepare
- #--------------------------------------------------------------------------
- def prepare(goods, shop)
- @goods = goods
- @shop = shop
- end
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_spell_class_window
- create_title_window
- create_gold_window
- create_command_window
- create_help_window
- create_class_window
- create_image_window
- create_buy_window
- create_msg_window
- end
- #--------------------------------------------------------------------------
- # * Create Spell Class Window
- #--------------------------------------------------------------------------
- def create_spell_class_window
- @spell_class_window = Window_Spell_Group.new
- @spell_class_window.viewport = @viewport
- @spell_class_window.x = Graphics.width - @spell_class_window.width
- @spell_class_window.group(@shop)
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_title_window
- @title_window = Window_Spell_Title.new
- @title_window.viewport = @viewport
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_msg_window
- @msg_window = Window_Spell_Message.new
- @msg_window.viewport = @viewport
- @msg_window.z = 210
- @msg_window.hide
- end
- #--------------------------------------------------------------------------
- # * Create Gold Window
- #--------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.viewport = @viewport
- @gold_window.x = Graphics.width - @gold_window.width
- @gold_window.y = @spell_class_window.height
- end
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- ww = Graphics.width - @gold_window.width
- @command_window = Window_SpellShopCommand.new(ww)
- @command_window.viewport = @viewport
- @command_window.y = @title_window.height
- @command_window.set_handler(:buy, method(:command_buy))
- @command_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # * Create Help Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Spell_Help.new
- @help_window.viewport = @viewport
- @help_window.y = @command_window.y + @command_window.height
- end
- #--------------------------------------------------------------------------
- # * Create Status Window
- #--------------------------------------------------------------------------
- def create_class_window
- wy = @help_window.y + @help_window.height
- wh = Graphics.height - @help_window.y - @help_window.height - 72
- @class_window = Window_ClassStatus.new(0, wy, wh)
- @class_window.viewport = @viewport
- @class_window.x = Graphics.width - @class_window.width
- end
- #--------------------------------------------------------------------------
- # * Create Status Window
- #--------------------------------------------------------------------------
- def create_image_window
- wy = Graphics.height - 72
- ww = Graphics.width
- wh = 72
- @image_window = Window_ImageStatus.new(0, wy, ww, wh)
- @image_window.viewport = @viewport
- @image_window.set_handler(:ok, method(:on_image_ok))
- @image_window.set_handler(:cancel, method(:on_image_cancel))
- end
- #--------------------------------------------------------------------------
- # * Create Purchase Window
- #--------------------------------------------------------------------------
- def create_buy_window
- wy = @help_window.y + @help_window.height
- ww = Graphics.width - @class_window.width
- wh = Graphics.height - @help_window.height - @help_window.y - @image_window.height
- @buy_window = Window_SpellBuy.new(wy, ww, wh, @goods)
- @buy_window.viewport = @viewport
- @buy_window.help_window = @help_window
- @buy_window.class_window = @class_window
- @buy_window.image_window = @image_window
- @buy_window.set_handler(:ok, method(:on_buy_ok))
- @buy_window.set_handler(:cancel, method(:on_buy_cancel))
- end
- #--------------------------------------------------------------------------
- # * Activate Purchase Window
- #--------------------------------------------------------------------------
- def command_buy
- @buy_window.money = money
- @buy_window.show.activate
- @buy_window.select(0)
- end
- #--------------------------------------------------------------------------
- # * Buy [OK]
- #--------------------------------------------------------------------------
- def on_buy_ok
- @item = @buy_window.item
- @image_window.activate
- @image_window.select(0)
- end
- #--------------------------------------------------------------------------
- # * Buy [Cancel]
- #--------------------------------------------------------------------------
- def on_buy_cancel
- @buy_window.unselect
- @image_window.item = nil
- @class_window.item = nil
- @command_window.activate
- @help_window.clear
- end
- #--------------------------------------------------------------------------
- # * Actor [OK]
- #--------------------------------------------------------------------------
- def on_image_ok
- index = @image_window.index
- act = $game_party.members[index]
- not_usable = true
- buy = false
- if act.skill_purchase?(@item)
- not_usable = false
- buy = true
- if act.spell_list[@item.spell_level] != nil
- buy = false if act.spell_list[@item.spell_level].include?(@item.id)
- buy = false if act.spell_list[@item.spell_level].size == Spell_Charge::Options::MAX_PER_LEVEL
- end
- else
- Sound.play_buzzer
- @image_window.activate
- end
- if buy
- $game_party.lose_gold(@item.spell_cost)
- @gold_window.refresh
- act.learn_spell(@item.id)
- @image_window.activate
- else
- if not_usable
- @msg_window.set_text(Vocab::Not_Usable)
- @msg_window.show
- @image_window.activate
- else
- if act.spell_list[@item.spell_level].size == Spell_Charge::Options::MAX_PER_LEVEL
- @msg_window.set_text(Vocab::Spells_Full)
- @msg_window.show
- @image_window.activate
- else
- @msg_window.set_text(Vocab::Spell_Owned)
- @msg_window.show
- @image_window.activate
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Actor [Cancel]
- #--------------------------------------------------------------------------
- def on_image_cancel
- @image_window.unselect
- @image_window.deactivate
- @buy_window.activate
- end
- #--------------------------------------------------------------------------
- # * Get Party Gold
- #--------------------------------------------------------------------------
- def money
- @gold_window.value
- end
- #--------------------------------------------------------------------------
- # Get Currency Unit
- #--------------------------------------------------------------------------
- def currency_unit
- @gold_window.currency_unit
- end
- #--------------------------------------------------------------------------
- # * Get Purchase Price
- #--------------------------------------------------------------------------
- def buying_price
- @buy_window.price(@item)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement