Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================#
- #========================== TOKEN SYSTEM ======================================#
- #==============================================================================#
- # CREATED BY ANDRIANFK AT 11/27/2014 (MY FAHKIN BEARD-DAY :DD ) #
- #==============================================================================#
- module AAA
- module Token
- BUY_SUCCESS = "Transaksi berhasil"
- BUY_FAILURE = "Transaksi gagal"
- NOT_ENOUGH_MONEY = "Uang anda tidak mencukupi"
- TYPE = "Mohon ketik #{type} anda.."
- end
- module ExchangeToken
- TokenExchange = 50
- # Berapa gold setara dengan 1 token?
- TokenFee = 1000
- # Berapa harga 1 token?
- end
- end
- #==============================================================================#
- class Win_TokenShop < Window_Base
- def initialize
- @win = super(1,1,120,80)
- @token_win = super(130,1,120,80)
- @exch_win = super(260,1,120,80)
- @userdat_win = super(390,1,125,300)
- @pulsa_win = super(1,130,100,70)
- @payment_win = super(120,130,80,54)
- @button1 = Button.new(@win,1,1,"Buy Token") { @token_win.active }
- @button2 = Button.new(@win,1,12,"Exchange Token") { @exch_win.active }
- @button3 = Button.new(@token_win,1,1,"PayPal"){ @userdat_win.active }
- @button4 = Button.new(@token_win,1,12,"Pulsa"){ @pulsa_win.active }
- @button5 = Button.new(@exch_win,1,(Font.default_size+42),"Exchange"){ exchanged(@textbox1.text.to_i*AAA::ExchangeToken,@textbox1.text.to_i) }
- @button6 = Button.new(@userdat_win,10,80,"Accept") { userdata_paypal(@textbox2.text) }
- @button7 = Button.new(@pulsa_win,48,50,"Accept") { userdata_pulsa(@textbox3.text) }
- @textbox1 = Textbox.new(@exch_win,3,40,106){ exchanged(@textbox1.text.to_i*AAA::ExchangeToken,@textbox1.text.to_i) }
- @textbox2 = Textbox.new(@userdat_win,5,50,280) { userdata_paypal(@textbox2.text) }
- @textbox3 = Textbox.new(@pulsa_win,3,25,85) { userdata_pulsa(@textbox3.text) }
- @check1 = CheckButton.new(@payment_win,5,5,"50 Token")
- @check2 = CheckButton.new(@payment_win,5,30,"100 Token")
- @exch_win.draw_text(20,1,contents.width,WLH,"Exchange Token")
- @userdat_win.draw_text(20,1,contents.width,WLH,"Paypal Buy")
- @userdat_win.draw_text(1,25,contents.width,WLH,"Paypal PIN/Token")
- @pulsa_win.draw_text(20,1,contents.width,WLH,"Pulsa/Token")
- end
- def update
- if @payment_win.active
- @check1.update
- @check2.update
- @payment_win.update
- end
- if @win.active
- @win.update
- @button1.update
- @button2.update
- end
- super
- if @token_win.active
- @button3.update
- @button4.update
- @token_win.update
- end
- if @exch_win.active
- @exch_win.update
- @button5.update
- @textbox1.update
- end
- if @userdat_win.active
- @userdat_win.update
- @button6.update
- @textbox2.update
- end
- if @pulsa_win.active
- @pulsa_win.update
- @button7.update
- @textbox3.update
- end
- end
- def userdata_pulsa(*args)
- num = args
- a = cektoken
- harga = a*ExchangeToken::TokenFee
- socket.send("<pulsa>#{num};#{harga}</pulsa>")
- if @successfull
- $window["alert"].open(AAA::Token::BUY_SUCCESS)
- $token += a
- elsif @failed
- if @not_enough
- $window["alert"].open(AAA::Token::NOT_ENOUGH_MONEY)
- else
- $window["alert"].open(AAA::Token::BUY_FAILURE)
- end
- end
- end
- def userdata_paypal(*args)
- $window["alert"].open("Fitur ini belum tersedia")
- end
- def cektoken
- hasil = 0
- if @check1.checked?
- hasil += 50
- end
- if @check2.checked?
- hasil += 100
- end
- return hasil
- end
- def exchanged(*args)
- $token-=args[1]
- $game_party.gain_gold(args[0])
- Sound.play_shop
- end
- end
- class Game_Party
- def token
- return $token
- end
- def add_token(add)
- $token += add
- end
- end
- class Scene_Servers < Scene_Base
- alias tokinit initialize
- def initialize
- tokinit
- @buttontobuy = Button.new(nil,1,43," Buy Token "){ Win_TokenShop.new }
- end
- alias tokupd update
- def update
- tokupd
- @buttontobuy.update
- end
- alias toktmnt terminate
- def terminate
- toktmnt
- @buttontobuy.dispose
- end
- end
- #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement