#==============================================================================
# ** Guild com funções para membros **
#------------------------------------------------------------------------------
# Permite dar cargos para os membros, existe dois cargos:
# Recruta: pode convidar membros.
# Sub Lider: pode convidar, expulsar, e dar cargos de recruta.
#
# Criada por Marlos Gama
# Editada por RD12 para poder dar cargos.
#==============================================================================
class Window_Guild < Window_Base
def initialize(x,y,a,b)
super(x,y,a,b)
self.contents = Bitmap.new(self.width-32, self.height-32)
self.back_opacity = 255
@dragable = true
@closable = true
self.z = 99999
# Botões de sair da guild, se for lider deleta a guild.
if $guild_position == "Lider"
@sair_guild2 = Button.new(self,10,180,"Deletar Guild") {deletar}
else
@sair_guild2 = Button.new(self,10,180,"Sair da Guild") {sairguild}
end
# Def's
# Se for Lider irá deletar a guild intao aparece um aviso.
def deletar
p " Se deletar sua Guild todos membros sairão dela ! Clique em Cancelar se não quiser!"
@sair_guild2 = Button.new(self,30,160," Deletar "){sair}
@sair_guild2 = Button.new(self,105,160," Cancelar ") {$scene = Scene_Map.new}
end
# Aqui aparece confirmando se quer sair ou deletar da guild
def sairguild
@sair_guild2 = Button.new(self,30,160," Confirmar "){sair}
@sair_guild2 = Button.new(self,105,160," Cancelar ") {$scene = Scene_Map.new}
end
@member_guild = Button.new(self,98+0+0,180," Membros On") {
$member_list.refresh;self.visible = false; self.active = false;
$flag2.visible = false; $member_list.visible = true; $member_list.active
= true }
# Comandos que vão aparecer para o Lider
if $guild_position == "Lider"
$guild_created_input = Text_Box.new(self,64,117,77,10)#caida te texto
$guild_created_input2 = Text_Box.new(self,64,137,77,10)#||
$guild_created_input3 = Text_Box.new(self,64,97,77,10)#||
$guild_created_input4 = Text_Box.new(self,64,157,77,10)#||
@liderto_guild = Button.new(self,145,97,"+") {liderto}# dar cargo de lider
@liderto_guild = Button.new(self,165,97,"-") {tlider} # tirar cargo de lider
@recruta_guild = Button.new(self,145,157,"+") {recruta}# dar cargo de recruta
@recruta_guild = Button.new(self,165,157,"-") {trecruta}# tirar cargo de recruta
@ok_guild = Button.new(self,145,117,"ADD") {ok} # Convidar para a guild
@delet_guild = Button.new(self,145,137,"DEL ") {del} # Expulsar da guild
else
$guild_created_input = Text_Box.new(self,200,207,77,10)
end
#Se a pessoa for SubLider aparecerá esses comandos
if $guild_position == "SubLider"
@recruta_guild = Button.new(self,145,157,"+") {recruta} #dar cargo recruta
@recruta_guild = Button.new(self,165,157,"-") {trecruta}#tirar cargo recruta
$guild_created_input4 = Text_Box.new(self,64,157,77,10)#caixa de texto
$guild_created_input = Text_Box.new(self,64,117,77,10) #||
$guild_created_input2 = Text_Box.new(self,64,137,77,10)#||
@ok_guild = Button.new(self,145,117,"ADD") {ok}#convidar
@delet_guild = Button.new(self,145,137,"DEL ") {del}# expulsar
else
#comandos para o Recruta
if $guild_position == "Recruta"
@ok_guild = Button.new(self,145,137,"ADD") {ok} # Convidar
$guild_created_input = Text_Box.new(self,64,137,77,10)# caixa de texto
end
refresh
end
end
def on_close
self.visible = false
self.active = false
$flag2.visible = false
$member_list.visible = false
$member_list.active = false
$fechando_ativar = true
end
def update
super
refresh if something_changed?
end
def something_changed?
return true if @old_guild != $game_party.actors[0].guild
return true if @old_position != $guild_position
return true if @old_pontos != $guild_points
return true if @old_lider != $guild_lider_name
return false
end
def refresh
@old_guild = $game_party.actors[0].guild
@old_position = $guild_position
@old_pontos = $guild_points
@old_lider = $guild_lider_name
self.contents.clear
self.contents.draw_text(47, 0, self.width-64 + 20, 42, $game_party.actors[0].guild)
self.contents.draw_text(0,30, self.width-64 + 20, 42, "Posição: " + $guild_position.to_s)
self.contents.draw_text(0,50, self.width-64 + 20, 42, "Pontos: " + $guild_points.to_s)
# Textos que vão aparecer para o Lider
if $guild_position == "Lider"
self.contents.draw_text(0, 67, self.width-64 + 20, 42, "Sub-Lider:")
self.contents.draw_text(0, 87, self.width-64 + 20, 42, "Convidar:")
self.contents.draw_text(0, 107, self.width-64 + 20, 42, "Expulsar:")
self.contents.draw_text(0, 127, self.width-64 + 20, 42, "Recruta:")
else
self.contents.draw_text(0, 70, self.width-64 + 20, 42, "Lider: "+$guild_lider_name.to_s)
#Textoas que vão aparecer para o SubLider
if $guild_position == "SubLider"
self.contents.draw_text(0, 127, self.width-64 + 20, 42, "Recruta:")
self.contents.draw_text(0, 87, self.width-64 + 20, 42, "Convidar:")
self.contents.draw_text(0, 107, self.width-64 + 20, 42, "Expulsar:")
else
# E para o Recruta
if $guild_position == "Recruta"
self.contents.draw_text(0, 107, self.width-64 + 20, 42, "Convidar:")
end
end
end
end
def del
for p in Network::Main.players.values
if p.nome == $guild_created_input2.text
if p.guild == $game_party.actors[0].guild
jogador = p.nome
return if p.position == "Lider"
Network::Main.pchat(p.netid,"[COM] [GDS] #{jogador}")
end
end
end
end
def ok
for p in Network::Main.players.values
if p.nome == $guild_created_input.text
flag = $flag.to_s
jogador = p.nome
lider_name = $game_party.actors[0].name
Network::Main.pchat(p.netid,"[COM] [GDD] #{$guild_name} #{jogador} #{flag} #{lider_name}")
end
end
end
# Def de dar cargo sub lider
def liderto
for p in Network::Main.players.values
if p.nome == $guild_created_input3.text
if p.guild == $game_party.actors[0].guild
jogador = p.nome
lider_name = $game_party.actors[0].name
liderto = $guild_position = "Lider"
Network::Main.pchat(p.netid,"[COM] [GLI] ")
end
end
end
end
# def de tirar cargo de sub lider
def tlider
for p in Network::Main.players.values
if p.nome == $guild_created_input3.text
if p.guild == $game_party.actors[0].guild
jogador = p.nome
lider_name = $game_party.actors[0].name
liderto = $guild_position = "Lider"
Network::Main.pchat(p.netid,"[COM] [GME] ")
end
end
end
end
# def de dar cargo de recruta
def recruta
for p in Network::Main.players.values
if p.nome == $guild_created_input4.text
if p.guild == $game_party.actors[0].guild
jogador = p.nome
lider_name = $game_party.actors[0].name
Network::Main.pchat(p.netid,"[COM] [GMR] ")
end
end
end
end
# def de tirar cargo de recruta
def trecruta
for p in Network::Main.players.values
if p.nome == $guild_created_input4.text
if p.guild == $game_party.actors[0].guild
jogador = p.nome
lider_name = $game_party.actors[0].name
Network::Main.pchat(p.netid,"[COM] [GMTR] ")
end
end
end
end
#Def de sair da guild ( se for lider a guild é deletada )
def sair
if $guild_position == "Lider"
Network::Main.send_register($guild_name.to_s+"-Guild-DEL" , $guild_name.to_s)
end
$guild_created.visible = false
$guild_created.active = false
$member_list.visible = false
$member_list.active = false
$guild_name = ""
$game_party.actors[0].guild = ""
$game_player.refresh
$scene = Scene_Map.new
Network::Main.send_start
$guild_position = "Membro"
$guild_points = 0
$flag2.visible = false
$fechando_ativar = true
end
end