Galera, eu preciso saber qual o código pra chamar a tela de enviar o email...
O script é esse:
O script é esse:
- Código:
#==============================================
# <> Mail Client v1.0
#==============================================
module SC # don't delete module, it's ripping if done anyway!
RXSC_MAIL = "Mail Client Script: Ver.1.0"
MAIL_HEAR_SOUND = true # set to true to hear a sound on receive
end
class Mail
attr_accessor :mail # Mail
attr_accessor :msg # Content of mail
attr_accessor :account # Your e-mail account
attr_accessor :sender # The sender
attr_accessor :read # If it's read or new
attr_accessor :font # Contents font
def initialize # Define the variables we're going to use
# Why are they global variables you ask? So we can use 'em outside this class
@mail = [] # mail IDs
@msg = {} # mail msgs
@account = "#{$game_party.actors[0].name.downcase}@#{User_Edit::GAME_MAIL}" # This is the player's mail
@sender = [] # sender IDs
@read = {} # unread option IDs
@font = {} # font
end
def received_include?(string) # check if string is in mail or sender (can be number)
if @mail.include?(string)
return true
elsif @sender.include?(string)
return true
else
return false
end
end
def is_new?(string) # see if mail is unread
if @read[string] == true
return false
elsif @read[string] == false
return true
else
return false
end
end
def write_mail(topic = nil,from = nil,msg = [], type = nil, font = nil)
if SC::MAIL_HEAR_SOUND == true # Sound when receiving
Audio.se_play("Audio/SE/055-Right01", 100, 150) # You may change the soundfile
# In fact, you may even use Music Effects, BGM (not recommended) or BGS.
# Change the 'se_play' to 'me_play','bgm_play' or 'bgs_play' respectivly.
# You should also change the directory when something else than SE is used.
end
if topic == nil or topic == ""# Subject of message
@mail.push("(Nenhuma Mensagem)") # if no subject specified
else
@mail.push(topic)
end
if msg == nil # Write a message in array format, like: ["line1, "line2, "etc"]
else
@msg[topic] = msg
end
if from == nil or from == "" # The sender of the mail
@sender.push("(Enviadas)") # if no sender specified
else
@sender.push(from)
end
if font != nil
@font[topic] = font
end
@read[topic] = false # set it to unread
if type != nil # some cool stuff
if type == 1
# Type 1: Corrupted Mail
@msg[topic].push("","* AUTO MAIL *","The mail is corrupted.","Sorry for this inconvinience.","","Greetings from Webmaster")
elsif type == 2
# Type 2: Infected Mail
@msg[topic].push("","* AUTO MAIL *","This mail is infected.","Delete it immediately.","","Greetings from Webmaster")
elsif type == 3
# Type 3: Incomplete Mail
@msg[topic].push("","* AUTO MAIL *","Mail was not sent correctly.","Some parts may have been lost.","","Greetings from Webmaster")
elsif type == 4
# Add more if you like, see above for the examples
end
end
end
end
# This is the topic window or in other words the message window.
# So this is the window where the contents of a mail is shown.
# You may change it in how you want it actually.
# Screwing this up is your own fault... but then again, you can always repaste...
class Window_Topic < Window_Base
def initialize(mail)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.font.color = normal_color
self.visible = false
@mail = mail # This is the index of the inbox and will be converted to the mail ID
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
unless @mail == "none" # Just a block
self.contents.draw_text(4, 0, self.width - 40, 32, "Assunto: #{$mail.mail[@mail]}")
self.contents.draw_text(4, 32, self.width - 40, 32, "De: #{$mail.sender[@mail]}")
self.contents.draw_text(4, 64, self.width - 40, 32, "Para: #{$mail.account}")
rect = Rect.new(0, 100, self.width, 2)
self.contents.fill_rect(rect, Color.new(255, 255, 255)) # Modify the color as pleased
end
end
def show_msg(msg) # Show the mail message contents
@topic = $mail.mail[@mail].to_s
@msg = $mail.msg[@topic]
y = 85 # start line 1 at this y-position
unless @msg == nil or @mail == "none" # Also just a block
for line in 0...3 # this is the message, as you see, max lines is 20
y += 16 # space between the lines
self.contents.font.size = 22 # font size
if $mail.font[@topic] != nil
self.contents.font.name = $mail.font[@topic] # own font
end
self.contents.draw_text(4, y, self.width, 32, @msg[line].to_s)
end
end
end
end
# This is the inbox
# When email is received it will be added at the end of the list.
# So that you can see, like the real one, which one's old or new.
class Window_Inbox < Window_Selectable
def initialize
super(0, 64, 640, 416)
@column_max = 1
self.index = 0
refresh
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...$mail.mail.size # This is the var for mails
@data.push($mail.mail[i])
end
@item_max = @data.size
if @item_max >= 0
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = 24
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
self.contents.font.color = normal_color
x = 4
y = index * 32 # 32 stands for space between lines
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(x, y, self.width - 40, 32, item.to_s) # mail topic (subject)
self.contents.draw_text(x + 400, y, self.width - 40, 32, $mail.sender[index].to_s) # Sender
if $mail.read[item] == false
self.contents.font.color = Color.new(130,225,89)
#self.contents.font.color = normal_color
self.contents.draw_text(x + 300, y, self.width - 40, 32, "NEW") # if mail is unread
else
self.contents.font.color = normal_color
self.contents.draw_text(x + 300, y, self.width - 40, 32, "") # if mail is read, change as pleased
end
end
end
# This is the built-in mail client.
# You may modify it but try not to screw it too much up.
class Scene_Mail
def main
@help_window = Window_Help.new
if $mail.mail.size == 0 or $mail.mail == nil
@help_window.set_text("#{$mail.account}// EMAIL: 0.")
else
@help_window.set_text("#{$mail.account}// EMAIL: #{$mail.mail.size}")
end
@help_window.z = 100
@inbox = Window_Inbox.new
@inbox.active = true
@inbox.visible = true
@inbox.z = 200
@topic_window = Window_Topic.new("none")
@topic_window.z = 100
@message_window = Window_Message.new # For msg's to show...
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@inbox.dispose
@topic_window.dispose
@message_window.dispose
@help_window.dispose
end
def update
@message_window.update
@inbox.update
@help_window.update
@topic_window.update
if $game_temp.message_window_showing
return
end
if @inbox.active == false
update_topic
return
end
if @inbox.active == true
update_inbox
return
end
end
def update_inbox
if $mail.mail.size == 0 or $mail.mail == nil
@inbox.index = -1
end
if Input.trigger?(Input::C) # selecting the topic at inbox
if @inbox.index == nil or $mail.mail.size == 0 # if no topics...
$game_system.se_play($data_system.buzzer_se) # errrr
return
end
$game_system.se_play($data_system.decision_se)
@topic_window.contents.clear
@topic_window = Window_Topic.new(@inbox.index)
@topic_window.show_msg(@inbox.index)
if $mail.read[$mail.mail[@inbox.index]] == false
$mail.read[$mail.mail[@inbox.index]] = true
@inbox.refresh
end
@topic_window.visible = true
@inbox.active = false
@inbox.visible = false
@help_window.visible = false
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new # This would be the previous scene
end
if Input.trigger?(Input::Z) # Deletes selected email
$mail.mail.delete_at(@inbox.index)
$mail.msg.delete(@inbox.index)
$mail.sender.delete_at(@inbox.index)
$game_system.se_play($data_system.decision_se)
@inbox.refresh
if $mail.mail.size == 0
@inbox.index = 0
@help_window.set_text("#{$mail.account}// EMAIL: 0")
else
@help_window.set_text("#{$mail.account}// EMAIL: #{$mail.mail.size}")
end
if @inbox.index > 1
@inbox.index -= 1
else
@inbox.index = 0
end
end
if Input.trigger?(Input::X) # Deletes all
$mail.mail.clear
$mail.msg.clear
$mail.sender.clear
$game_system.se_play($data_system.decision_se)
@inbox.refresh
@help_window.set_text("#{$mail.account}// EMAIL: #{$mail.mail.size}")
@inbox.index = -1 # this will make the cursor be hidden (cuz there arent any mails)
end
end
def update_topic # this command is for the topic window, add stuff if you like
if Input.trigger?(Input::B) # cancel button to return to inbox
$game_system.se_play($data_system.cancel_se)
@inbox.active = true
@inbox.visible = true
@help_window.visible = true
@topic_window.visible = false
end
end
end
#==============================================================================
# ■ Scene_Text
#------------------------------------------------------------------------------
# メニュー画面の処理を行うクラスです。
#==============================================================================
class Scene_Write_Mail
#-----------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
@input_dest_window = Input_MDest.new(12)
@input_topic_window = Input_MTopic.new(20)
@text_linee_1 = Input_MText.new(50)
@text_linee_2 = Input_MText.new(50,0,195)
@text_linee_3 = Input_MText.new(50,0,260)
#@back = Window_Back.new
@send_button = Window_Button.new(500,400,64,48)
@send_button.set_text('Enviar')
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
@input_dest_window.dispose
@input_topic_window.dispose
@text_linee_1.dispose
@text_linee_2.dispose
@text_linee_3.dispose
@send_button.dispose
#@back.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
$mouse.update
if #$mouse.over?(@send_button) and Input.trigger?(Input::Mouse_Left)
#$mail.write_mail(@input_topic_window.testo,$game_party.actors[0].name,[@text_linee_1.testo,@text_linee_2.testo,@text_linee_3.testo])
Network::Main.socket.send("<10b>mail('#{@input_topic_window.testo}','#{$game_party.actors[0].name}','#{@text_linee_1.testo}','#{@text_linee_2.testo}','#{@text_linee_3.testo}','#{@input_dest_window.testo}')\n")
$scene = Scene_Reinit.new
return
end
if @input_dest_window #Input.trigger?(Input::Mouse_Left)#$mouse.over?(@input_dest_window)
@input_dest_window.update
return
end
if@input_topic_window #Input.trigger?(Input::Mouse_Left)#$mouse.over?(@input_topic_window)
@input_topic_window.update
return
end
if @text_linee_1 #Input.trigger?(Input::Mouse_Left)#$mouse.over?(@text_linee_1)
@text_linee_1.update
return
end
if @text_linee_2 #Input.trigger?(Input::Mouse_Left)#$mouse.over?(@text_linee_2)
@text_linee_2.update
return
end
if @text_linee_3 #Input.trigger?(Input::Mouse_Left)#$mouse.over?(@text_linee_3)
@text_linee_3.update
return
end
if Input.trigger?(Input::B)
$scene = Scene_Map.new
end
end
end
module Network
class Main
def self.mail(a,b,c,d,e,f)
$mail.write_mail(a,b,[c,d,e]) if $game_party.actors[0].name.downcase == f
end
end
end
#==============================================================================
# ** Input_MDest
#------------------------------------------------------------------------------
# PERMETTE DI SCRIVERE UN TESTO DENTRO UNA CASELLA
#==============================================================================
#topic = nil,from = nil,msg = []
class Input_MDest < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(massimo,x=0,y=0,a=640,b=64)
super(x,y,a,b)
self.contents = Bitmap.new(width - 32, height - 32)
@text = []
@massimo = massimo
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0,-8, 640, 32, "Para: ")
self.contents.draw_text(120,-8, 640, 32, "#{@text.to_s}")
end
def testo
return @text.to_s
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
#update keys
update_rup_keys if !Input.pressed?(Input::Shift)
update_rlow_keys if Input.pressed?(Input::Shift)
#Space
@text.push(" ") if Input.triggerd?(Input::Space)
# Removes last entry in test.
@text.delete_at(-1) if Input.triggerd?(Input::Back) and @text.size != 0
refresh
end
def update_rup_keys
#Checks for Numberkeys input.
for key in Input::Numberkeys.keys
@text.push(key.to_s) if Input.triggerd?(Input::Numberkeys[key])
end
#Checks for Letter input.
for key in Input::Letters.keys
@text.push(key.downcase.to_s) if Input.triggerd?(Input::Letters[key])
end
#Checks for other keys
@text.push("-") if Input.triggerd?(Input::Underscore)
@text.push(".") if Input.triggerd?(Input::Dot)
@text.push(",") if Input.triggerd?(Input::Comma)
@text.push("/") if Input.triggerd?(Input::Backslash)
@text.push("'") if Input.triggerd?(Input::Quote)
@text.push("=") if Input.triggerd?(Input::Equal)
end
#-------------------------------------------------------------------------
# * Updates LowerKeys
#-------------------------------------------------------------------------
def update_rlow_keys
#Checks for Numberkeys input.
for key in Input::Numberkeys.keys
if Input.triggerd?(Input::Numberkeys[key])
@text.push("!") if key == 1
@text.push("@") if key == 2
@text.push("?") if key == 3
@text.push("$") if key == 4
@text.push("%") if key == 5
@text.push("^") if key == 6
@text.push("&") if key == 7
@text.push("*") if key == 8
@text.push("(") if key == 9
@text.push(")") if key == 0
end
end
#Checks for Letter input.
for key in Input::Letters.keys
@text.push(key.upcase.to_s) if Input.triggerd?(Input::Letters[key])
end
#Checks for Other keys
@text.push("_") if Input.triggerd?(Input::Underscore)
@text.push(">") if Input.triggerd?(Input::Dot)
@text.push("<") if Input.triggerd?(Input::Comma)
@text.push("?") if Input.triggerd?(Input::Backslash)
@text.push("''") if Input.triggerd?(Input::Quote)
@text.push("+") if Input.triggerd?(Input::Equal)
end
end
#==============================================================================
# ** Input_MTopic
#------------------------------------------------------------------------------
# PERMETTE DI SCRIVERE UN TESTO DENTRO UNA CASELLA
#==============================================================================
#topic = nil,from = nil,msg = [], type = nil, font = nil)
class Input_MTopic < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(massimo,x=0,y=65,a=640,b=64)
super(x,y,a,b)
self.contents = Bitmap.new(width - 32, height - 32)
@text = []
@massimo = massimo
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0,-8, 640, 32, "Assunto: ")
self.contents.draw_text(120,-8, 640, 32, "#{@text.to_s}")
end
def testo
return @text.to_s
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
#update keys
update_rup_keys if !Input.pressed?(Input::Shift)
update_rlow_keys if Input.pressed?(Input::Shift)
#Space
@text.push(" ") if Input.triggerd?(Input::Space)
# Removes last entry in test.
@text.delete_at(-1) if Input.triggerd?(Input::Back) and @text.size != 0
refresh
end
def update_rup_keys
#Checks for Numberkeys input.
for key in Input::Numberkeys.keys
@text.push(key.to_s) if Input.triggerd?(Input::Numberkeys[key])
end
#Checks for Letter input.
for key in Input::Letters.keys
@text.push(key.downcase.to_s) if Input.triggerd?(Input::Letters[key])
end
#Checks for other keys
@text.push("-") if Input.triggerd?(Input::Underscore)
@text.push(".") if Input.triggerd?(Input::Dot)
@text.push(",") if Input.triggerd?(Input::Comma)
@text.push("/") if Input.triggerd?(Input::Backslash)
@text.push("'") if Input.triggerd?(Input::Quote)
@text.push("=") if Input.triggerd?(Input::Equal)
end
#-------------------------------------------------------------------------
# * Updates LowerKeys
#-------------------------------------------------------------------------
def update_rlow_keys
#Checks for Numberkeys input.
for key in Input::Numberkeys.keys
if Input.triggerd?(Input::Numberkeys[key])
@text.push("!") if key == 1
@text.push("@") if key == 2
@text.push("?") if key == 3
@text.push("$") if key == 4
@text.push("%") if key == 5
@text.push("^") if key == 6
@text.push("&") if key == 7
@text.push("*") if key == 8
@text.push("(") if key == 9
@text.push(")") if key == 0
end
end
#Checks for Letter input.
for key in Input::Letters.keys
@text.push(key.upcase.to_s) if Input.triggerd?(Input::Letters[key])
end
#Checks for Other keys
@text.push("_") if Input.triggerd?(Input::Underscore)
@text.push(">") if Input.triggerd?(Input::Dot)
@text.push("<") if Input.triggerd?(Input::Comma)
@text.push("?") if Input.triggerd?(Input::Backslash)
@text.push("''") if Input.triggerd?(Input::Quote)
@text.push("+") if Input.triggerd?(Input::Equal)
end
end
#==============================================================================
# ** Input_MText
#------------------------------------------------------------------------------
# PERMETTE DI SCRIVERE UN TESTO DENTRO UNA CASELLA
#==============================================================================
#topic = nil,from = nil,msg = []
class Input_MText < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(mass,x=0,y=130,a=640,b=64)
super(x,y,a,b)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@text = []
@massimo = mass
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0,-8, 640, 32, "Linha: #{@text.to_s}")
end
def testo
return @text.to_s
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
#update keys
update_rup_keys if !Input.pressed?(Input::Shift)
update_rlow_keys if Input.pressed?(Input::Shift)
#Space
@text.push(" ") if Input.triggerd?(Input::Space)
# Removes last entry in test.
@text.delete_at(-1) if Input.triggerd?(Input::Back) and @text.size != 0
refresh
end
def update_rup_keys
#Checks for Numberkeys input.
for key in Input::Numberkeys.keys
@text.push(key.to_s) if Input.triggerd?(Input::Numberkeys[key]) if @text.size <= @massimo
end
#Checks for Letter input.
for key in Input::Letters.keys
@text.push(key.downcase.to_s) if Input.triggerd?(Input::Letters[key]) if @text.size <= @massimo
end
#Checks for other keys
@text.push("-") if Input.triggerd?(Input::Underscore)
@text.push(".") if Input.triggerd?(Input::Dot)
@text.push(",") if Input.triggerd?(Input::Comma)
@text.push("/") if Input.triggerd?(Input::Backslash)
@text.push("'") if Input.triggerd?(Input::Quote)
@text.push("=") if Input.triggerd?(Input::Equal)
end
#-------------------------------------------------------------------------
# * Updates LowerKeys
#-------------------------------------------------------------------------
def update_rlow_keys
#Checks for Numberkeys input.
for key in Input::Numberkeys.keys
if Input.triggerd?(Input::Numberkeys[key])
@text.push("!") if key == 1
@text.push("@") if key == 2
@text.push("?") if key == 3
@text.push("$") if key == 4
@text.push("%") if key == 5
@text.push("^") if key == 6
@text.push("&") if key == 7
@text.push("*") if key == 8
@text.push("(") if key == 9
@text.push(")") if key == 0
end
end
#Checks for Letter input.
for key in Input::Letters.keys
@text.push(key.upcase.to_s) if Input.triggerd?(Input::Letters[key])
end
#Checks for Other keys
@text.push("_") if Input.triggerd?(Input::Underscore)
@text.push(">") if Input.triggerd?(Input::Dot)
@text.push("<") if Input.triggerd?(Input::Comma)
@text.push("?") if Input.triggerd?(Input::Backslash)
@text.push("''") if Input.triggerd?(Input::Quote)
@text.push("+") if Input.triggerd?(Input::Equal)
end
end
- Código:
Scene_Write_Mail