#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/Nazwa: Dodatkowa waluta.............._/
#_/Autor: Teyan (www.ultimateam.pl)._/
#_/Data: 28 kwietnia 2010r................_/
#_/Wersja: 2.0..............................._/
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#instrukcja
#switch/prze??cznik, który odpowiada za zmiane waluty
GOLD = 20 #mo?emy go oczywi?cie zmieni?.
#gdy jest off to u?ywan? walut? jest nowa waluta
#gdy jest on to u?ywan? walut? jest stara waluta
#wywo?uj?c skrypt:
# $scene = Scene_Kantor.new
#otworzy si? nam okno z mo?liwo?ci? kupna/sprzeda?y waluty
#jak w banku mo?na wymienia? pieni?dze na inn? walut?
#najlepiej wywo?a? ten skrypt w poleceniu jakiego? NPC-ta
#takim NPC-tem mo?e by? np: "Królewski Skarbnik" (chyba wiecie o co chodzi?)
#facet b?dzie nam wymienia? pieni?dze: kryszta?y na z?oto i odwrotnie
module Teyan
Kurs = 200# w % (oznacza, ?e 2. Waluta = 200% pierwszej waluty) [domy?lnie: 1 kryszta? = 2 sztuki z?ota]
Icon1 = 205# ikonka pierwszej waluty
Icon2 = 200# ikonka drugiej waluty
Nazwa1 = ' G'#skrócona nazwa pierwszej waluty
Nazwa2 = ' K'#skrócona nazwa drugiej waluty
Kup = 100 # % ceny kupna (normalnie jest to 100)
Sprzedaj = 50 # % ceny sprzedania (normalnie jest to 50)
# wywo?uj?c skrypt:
# Teyan::Sprzedaj = x (gdzie X musi by? liczb? dodatni? i ca?kowit?)
# sprawimy, ?e nasz bohater b?dzie sprzedawa? przedmioty po X% ich ceny
#
# mo?emy wywo?a? skrypt:
# Teyan::Kup = x (gdzie X musi by? liczb? dodatni? i ca?kowit?)
# sprawimy, ?e nasz bohater b?dzie kupowa? przedmioty po X% ich ceny
# je?eli wywo?amy ten skrypt:
# Teyan::Sprzedaj = 105 (nast?pi inflacja o 5% - ceny wzrosn?)
end
#~~~~~~~~~~~~~~~~~~SKRYPT
class Window_Gold < Window_Base
def initialize(x, y)
super(x, y, 160, WLH * 2 + 32)
refresh
end
def refresh
self.contents.clear
draw_icon(Teyan::Icon1 , 4 , 0)
draw_icon(Teyan::Icon2 , 4 , 24)
self.contents.draw_text(0, 0, 120, 24, [$game_party.gold, Teyan::Nazwa1], 2)
self.contents.draw_text(0, 24, 120, 24, [$game_party.gold2, Teyan::Nazwa2], 2)
end
end
class Game_Party < Game_Unit
attr_reader :gold2
def initialize
super
@gold = 0
@gold2 = 0
@steps = 0
@last_item_id = 0
@last_actor_index = 0
@last_target_index = 0
@actors = [] # Party member (actor ID)
@items = {} # Inventory item hash (item ID)
@weapons = {} # Inventory item hash (weapon ID)
@armors = {} # Inventory item hash (armor ID)
end
def gain_gold(n)
if $game_switches[GOLD]
@gold = [[@gold + n, 0].max, 9999999].min
else
@gold2 = [[@gold2 + n, 0].max, 9999999].min
end
end
def lose_gold(n)
gain_gold(-n)
end
end
class Scene_Menu < Scene_Base
def start
super
create_menu_background
create_command_window
@gold_window = Window_Gold.new(0, 336)
@status_window = Window_MenuStatus.new(161, 0)
end
end
class Scene_Shop < Scene_Base
def start
super
create_menu_background
create_command_window
@help_window = Window_Help.new
@gold_window = Window_Gold.new(384, 56)
@dummy_window = Window_Base.new(0, 136, 544, 280)
@buy_window = Window_ShopBuy.new(0, 136)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@sell_window = Window_ShopSell.new(0, 136, 544, 280)
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
@number_window = Window_ShopNumber.new(0, 136)
@number_window.active = false
@number_window.visible = false
@status_window = Window_ShopStatus.new(304, 136)
@status_window.visible = false
end
def update_buy_selection
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if $game_switches[GOLD]
if @item == nil or (@item.price * Teyan::Kup / 100) > $game_party.gold or number == 99
Sound.play_buzzer
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold / (@item.price * Teyan::Kup / 100)
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price * Teyan::Kup / 100)
@number_window.active = true
@number_window.visible = true
end
else
if @item == nil or (@item.price * Teyan::Kup * 100 / Teyan::Kurs / 100) > $game_party.gold2 or number == 99
Sound.play_buzzer
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold2 / (@item.price * Teyan::Kup * 100 / Teyan::Kurs / 100)
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price * Teyan::Kup * 100 / Teyan::Kurs / 100)
@number_window.active = true
@number_window.visible = true
end
end
end
end
def create_command_window
s1 = Vocab::ShopBuy
s2 = Vocab::ShopSell
s3 = Vocab::ShopCancel
@command_window = Window_Command.new(384, [s1, s2, s3], 3)
@command_window.y = 56
@command_window.height = 80
if $game_temp.shop_purchase_only
@command_window.draw_item(1, false)
end
end
def update_sell_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@sell_window.active = false
@sell_window.visible = false
@status_window.item = nil
@help_window.set_text("")
elsif Input.trigger?(Input::C)
@item = @sell_window.item
@status_window.item = @item
if @item == nil or @item.price == 0
Sound.play_buzzer
else
Sound.play_decision
max = $game_party.item_number(@item)
@sell_window.active = false
@sell_window.visible = false
if $game_switches[GOLD]
@number_window.set(@item, max, @item.price * Teyan::Sprzedaj / 100)
else
@number_window.set(@item, max, @item.price * Teyan::Sprzedaj * 100 / Teyan::Kurs / 100)
end
@number_window.active = true
@number_window.visible = true
@status_window.visible = true
end
end
end
def decide_number_input
Sound.play_shop
@number_window.active = false
@number_window.visible = false
case @command_window.index
when 0 # Buy
if $game_switches[GOLD]
$game_party.lose_gold(@number_window.number * @item.price * Teyan::Kup / 100)
else
$game_party.lose_gold(@number_window.number * @item.price * Teyan::Kup * 100 / Teyan::Kurs / 100)
end
$game_party.gain_item(@item, @number_window.number)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
@buy_window.active = true
@buy_window.visible = true
when 1 # sell
if $game_switches[GOLD]
$game_party.gain_gold(@number_window.number * (@item.price * Teyan::Sprzedaj / 100))
else
$game_party.gain_gold(@number_window.number * (@item.price * Teyan::Sprzedaj * 100 / Teyan::Kurs / 100))
end
$game_party.lose_item(@item, @number_window.number)
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
end
end
class Window_ShopBuy < Window_Selectable
def initialize(x, y)
super(x, y, 304, 280)
@shop_goods = $game_temp.shop_goods
refresh
self.index = 0
end
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item)
if $game_switches[GOLD]
enabled = (item.price * Teyan::Kup / 100 <= $game_party.gold and number < 99)
else
enabled = (item.price * Teyan::Kup * 100 / Teyan::Kurs / 100 <= $game_party.gold2 and number < 99)
end
rect = item_rect(index)
self.contents.clear_rect(rect)
draw_item_name(item, rect.x, rect.y, enabled)
rect.width -= 4
if $game_switches[GOLD]
self.contents.draw_text(rect, item.price * Teyan::Kup / 100, 2)
else
self.contents.draw_text(rect, item.price * Teyan::Kup * 100 / Teyan::Kurs / 100, 2)
end
end
end
class Window_ShopNumber < Window_Base
def initialize(x, y)
super(x, y, 304, 280)
@item = nil
@max = 1
@price = 0
@number = 1
end
end
class Window_Base < Window
def draw_currency_value(value, x, y, width)
if $game_switches[GOLD]
cx = contents.text_size(Teyan::Nazwa1).width
else
cx = contents.text_size(Teyan::Nazwa2).width
end
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width-cx-2, WLH, value, 2)
self.contents.font.color = system_color
if $game_switches[GOLD]
self.contents.draw_text(x, y, width, WLH, Teyan::Nazwa1, 2)
else
self.contents.draw_text(x, y, width, WLH, Teyan::Nazwa2, 2)
end
end
end
####################################
#KANTOR!!!!!!!!!!!!!!!!!!!!!!!!
####################################
class Game_Party < Game_Unit
def gain_gold1(n)
@gold = [[@gold + n, 0].max, 9999999].min
end
def lose_gold1(n)
gain_gold1(-n)
end
def gain_gold2(n)
@gold2 = [[@gold2 + n, 0].max, 9999999].min
end
def lose_gold2(n)
gain_gold2(-n)
end
end
class Scene_Kantor < Scene_Base
def start
create_menu_background
create_command_window
create_command_window1
create_command_window2
@gold_window = Window_Gold.new(0, 0)
@gold_window.visible = false
@help_window = Okno_Pomocy.new
@help_window.visible = false
end
def terminate
super
dispose_menu_background
@gold_window.dispose
@help_window.dispose
@command_window.dispose
@command_window1.dispose
@command_window2.dispose
end
def update
super
update_menu_background
@gold_window.update
@help_window.update
@command_window.update
@command_window1.update
@command_window2.update
if @command_window.active
update_command_selection
elsif @command_window1.active
update_command_selection1
elsif @command_window2.active
update_command_selection2
end
end
def update_command_selection1
if Input.trigger?(Input::C)
case @command_window1.index
when 0
if $game_party.gold < 10
Sound.play_buzzer
else
Sound.play_decision
kasa = 10 * 100 / Teyan::Kurs
$game_party.lose_gold1(kasa * Teyan::Kurs / 100)
$game_party.gain_gold2(kasa)
@gold_window.refresh
sprawdzanie
end
when 1
if $game_party.gold < 20
Sound.play_buzzer
else
Sound.play_decision
kasa = 20 * 100 / Teyan::Kurs
$game_party.lose_gold1(kasa * Teyan::Kurs / 100)
$game_party.gain_gold2(kasa)
@gold_window.refresh
sprawdzanie
end
when 2
if $game_party.gold < 50
Sound.play_buzzer
else
Sound.play_decision
kasa = 50 * 100 / Teyan::Kurs
$game_party.lose_gold1(kasa * Teyan::Kurs / 100)
$game_party.gain_gold2(kasa)
@gold_window.refresh
sprawdzanie
end
when 3
if $game_party.gold < 100
Sound.play_buzzer
else
Sound.play_decision
kasa = 100 * 100 / Teyan::Kurs
$game_party.lose_gold1(kasa * Teyan::Kurs / 100)
$game_party.gain_gold2(kasa)
@gold_window.refresh
sprawdzanie
end
when 4
if $game_party.gold < 200
Sound.play_buzzer
else
Sound.play_decision
kasa = 200 * 100 / Teyan::Kurs
$game_party.lose_gold1(kasa * Teyan::Kurs / 100)
$game_party.gain_gold2(kasa)
@gold_window.refresh
sprawdzanie
end
when 5
if $game_party.gold == 0
Sound.play_buzzer
else
Sound.play_decision
kasa = $game_party.gold * 100 / Teyan::Kurs
$game_party.lose_gold1(kasa * Teyan::Kurs / 100)
$game_party.gain_gold2(kasa)
@gold_window.refresh
sprawdzanie
end
when 6
Sound.play_decision
@command_window.active = true
@command_window.visible = true
@gold_window.visible = false
@command_window1.active = false
@command_window1.visible = false
@help_window.visible = false
when 7
Sound.play_decision
$scene = Scene_Map.new
end
end
end
def update_command_selection2
if Input.trigger?(Input::C)
case @command_window2.index
when 0
if $game_party.gold2 < 10
Sound.play_buzzer
else
Sound.play_decision
kasa = 10
$game_party.lose_gold2(kasa)
$game_party.gain_gold1(kasa * Teyan::Kurs / 100)
@gold_window.refresh
sprawdzanie
end
when 1
if $game_party.gold2 < 20
Sound.play_buzzer
else
Sound.play_decision
kasa = 20
$game_party.lose_gold2(kasa)
$game_party.gain_gold1(kasa * Teyan::Kurs / 100)
@gold_window.refresh
sprawdzanie
end
when 2
if $game_party.gold2 < 50
Sound.play_buzzer
else
Sound.play_decision
kasa = 50
$game_party.lose_gold2(kasa)
$game_party.gain_gold1(kasa * Teyan::Kurs / 100)
@gold_window.refresh
sprawdzanie
end
when 3
if $game_party.gold2 < 100
Sound.play_buzzer
else
Sound.play_decision
kasa = 100
$game_party.lose_gold2(kasa)
$game_party.gain_gold1(kasa * Teyan::Kurs / 100)
@gold_window.refresh
sprawdzanie
end
when 4
if $game_party.gold2 < 200
Sound.play_buzzer
else
Sound.play_decision
kasa = 200
$game_party.lose_gold2(kasa)
$game_party.gain_gold1(kasa * Teyan::Kurs / 100)
@gold_window.refresh
sprawdzanie
end
when 5
if $game_party.gold2 == 0
Sound.play_buzzer
else
Sound.play_decision
kasa = $game_party.gold2
$game_party.lose_gold2(kasa)
$game_party.gain_gold1(kasa * Teyan::Kurs / 100)
@gold_window.refresh
sprawdzanie
end
when 6
Sound.play_decision
@command_window.active = true
@command_window.visible = true
@gold_window.visible = false
@command_window2.active = false
@command_window2.visible = false
@help_window.visible = false
when 7
Sound.play_decision
$scene = Scene_Map.new
end
end
end
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_decision
$scene = Scene_Map.new
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
if $game_party.gold == 0
Sound.play_buzzer
else
Sound.play_decision
@command_window.active = false
@command_window.visible = false
@gold_window.visible = true
@command_window1.active = true
@command_window1.visible = true
@help_window.visible = true
@help_window.wstaw_ikonki(Teyan::Icon1, Teyan::Icon2)
end
when 1
if $game_party.gold2 == 0
Sound.play_buzzer
else
Sound.play_decision
@command_window.active = false
@command_window.visible = false
@gold_window.visible = true
@command_window2.active = true
@command_window2.visible = true
@help_window.visible = true
@help_window.wstaw_ikonki(Teyan::Icon2, Teyan::Icon1)
end
end
end
end
def create_command_window
s1 = 'Wymie? z?oto na kryszta?y.'
s2 = 'Wymie? kryszta?y na z?oto.'
@command_window = Window_Command.new(544, [s1, s2], 1)
@command_window.y = 288
@command_window.z = 400
@command_window.height = 128
@command_window.active = true
@command_window.visible = true
if $game_party.gold < 1
@command_window.draw_item(0, false)
end
if $game_party.gold2 < 1
@command_window.draw_item(1, false)
end
end
def create_command_window1
s1 = 'Wymie? 10szt.'
s2 = 'Wymie? 20szt.'
s3 = 'Wymie? 50szt.'
s4 = 'Wymie? 100szt.'
s5 = 'Wymie? 200szt.'
s6 = 'Wymie? wszystko.'
s7 = 'Wró?.'
s8 = 'Koniec.'
@command_window1 = Window_Command.new(544, [s1, s2, s3, s4, s5, s6, s7, s8], 2)
@command_window1.y = 288
@command_window1.z = 400
@command_window1.height = 128
@command_window1.active = false
@command_window1.visible = false
if $game_party.gold < 200
@command_window1.draw_item(4, false)
if $game_party.gold < 100
@command_window1.draw_item(3, false)
if $game_party.gold < 50
@command_window1.draw_item(2, false)
if $game_party.gold < 20
@command_window1.draw_item(1, false)
if $game_party.gold < 10
@command_window1.draw_item(0, false)
if $game_party.gold < 1
@command_window1.draw_item(5, false)
end
end
end
end
end
end
end
def create_command_window2
s1 = 'Wymie? 10szt.'
s2 = 'Wymie? 20szt.'
s3 = 'Wymie? 50szt.'
s4 = 'Wymie? 100szt.'
s5 = 'Wymie? 200szt.'
s6 = 'Wymie? wszystko.'
s7 = 'Wró?.'
s8 = 'Koniec.'
@command_window2 = Window_Command.new(544, [s1, s2, s3, s4, s5, s6, s7, s8], 2)
@command_window2.y = 288
@command_window2.z = 400
@command_window2.height = 128
@command_window2.active = false
@command_window2.visible = false
if $game_party.gold2 < 200
@command_window2.draw_item(4, false)
if $game_party.gold2 < 100
@command_window2.draw_item(3, false)
if $game_party.gold2 < 50
@command_window2.draw_item(2, false)
if $game_party.gold2 < 20
@command_window2.draw_item(1, false)
if $game_party.gold2 < 10
@command_window2.draw_item(0, false)
if $game_party.gold2 < 1
@command_window2.draw_item(5, false)
end
end
end
end
end
end
end
def sprawdzanie
if $game_party.gold < 1
@command_window.draw_item(0, false)
else
@command_window.draw_item(0, true)
end
if $game_party.gold2 < 1
@command_window.draw_item(1, false)
else
@command_window.draw_item(1, true)
end
if $game_party.gold < 200
@command_window1.draw_item(4, false)
else
@command_window1.draw_item(4, true)
end
if $game_party.gold < 100
@command_window1.draw_item(3, false)
else
@command_window1.draw_item(3, true)
end
if $game_party.gold < 50
@command_window1.draw_item(2, false)
else
@command_window1.draw_item(2, true)
end
if $game_party.gold < 20
@command_window1.draw_item(1, false)
else
@command_window1.draw_item(1, true)
end
if $game_party.gold < 10
@command_window1.draw_item(0, false)
else
@command_window1.draw_item(0, true)
end
if $game_party.gold < 1
@command_window1.draw_item(5, false)
else
@command_window1.draw_item(5, true)
end
if $game_party.gold2 < 200
@command_window2.draw_item(4, false)
else
@command_window2.draw_item(4, true)
end
if $game_party.gold2 < 100
@command_window2.draw_item(3, false)
else
@command_window2.draw_item(3, true)
end
if $game_party.gold2 < 50
@command_window2.draw_item(2, false)
else
@command_window2.draw_item(2, true)
end
if $game_party.gold2 < 20
@command_window2.draw_item(1, false)
else
@command_window2.draw_item(1, true)
end
if $game_party.gold2 < 10
@command_window2.draw_item(0, false)
else
@command_window2.draw_item(0, true)
end
if $game_party.gold2 < 1
@command_window2.draw_item(5, false)
else
@command_window2.draw_item(5, true)
end
end
end
class Okno_Pomocy < Window_Base
def initialize
super(216, 232, 116, 56)
end
def wstaw_ikonki(icon1 = 205, icon2 = 200)
self.contents.clear
draw_icon(icon1, 0, 0)
self.contents.draw_text(24, 0, 32, 24, '=>', 1)
draw_icon(icon2, 56, 0)
end
end