Boa tarde galera,
Estou com uma duvida no WingMMO.
Estou tentando exibir valores de determinadas variaveis na janela windows_character, que exibe as informações gerais do personagem.
A tela é essa:
Queria aumentar ela, na altura, incluindo mais uma divisória, e nesta nova parte, incluir alguns textos e valores de variaveis, por exemplo:
(um ícone) Nivel de Mineração: (Exibir valor da variavel)
Alguém consegue me ajudar?
Abaixo o código da class window_character
Estou com uma duvida no WingMMO.
Estou tentando exibir valores de determinadas variaveis na janela windows_character, que exibe as informações gerais do personagem.
A tela é essa:
Queria aumentar ela, na altura, incluindo mais uma divisória, e nesta nova parte, incluir alguns textos e valores de variaveis, por exemplo:
(um ícone) Nivel de Mineração: (Exibir valor da variavel)
Alguém consegue me ajudar?
Abaixo o código da class window_character
- Código:
class Window_Character < Window_Base
def initialize
super(0, 0, (window_width / 2) + 140, window_height + 12)
self.z = 200
@positiony = 2 # Posição na tela
@positionx = 2
self.y = ((Graphics.height) / 2) - (self.height / 2)
self.x = ((Graphics.width) / 2) - (self.width / 2)
@tempvalue = 1
self.draggable = true
self.closable = true
self.title = "Informações gerais"
#classicon = 131 if StructManager.Player($game_system.MyIndex).Class == "1"
#classicon = 134 if StructManager.Player($game_system.MyIndex).Class == "2"
#classicon = 138 if StructManager.Player($game_system.MyIndex).Class == "3"
#classicon = 132 if StructManager.Player($game_system.MyIndex).Class == "4"
#self.contents.font.color = $ColorYellow
@bttnfire = Button.new(self, 106, 179, 11, 11, "+", true)
@bttnearth = Button.new(self, 106, 195, 11, 11, "+", true)
@bttnwater = Button.new(self, 106, 211, 11, 11, "+", true)
@bttnwind = Button.new(self, 244, 179, 11, 11, "+", true)
@bttndark = Button.new(self, 244, 195, 11, 11, "+", true)
@bttnlight = Button.new(self, 244, 211, 11, 11, "+", true)
@bttnfirew = Button.new(self, 117, 179, 11, 11, "?", true)
@bttnearthw = Button.new(self, 117, 195, 11, 11, "?", true)
@bttnwaterw = Button.new(self, 117, 211, 11, 11, "?", true)
@bttnwindw = Button.new(self, 255, 179, 11, 11, "?", true)
@bttndarkw = Button.new(self, 255, 195, 11, 11, "?", true)
@bttnlightw = Button.new(self, 255, 211, 11, 11, "?", true)
#----------
@bttnfire.mouse_click { Network.RequestUsePoints(1) }
@bttnearth.mouse_click { Network.RequestUsePoints(2) }
@bttnwater.mouse_click { Network.RequestUsePoints(3) }
@bttnwind.mouse_click { Network.RequestUsePoints(4) }
@bttndark.mouse_click { Network.RequestUsePoints(5) }
@bttnlight.mouse_click { Network.RequestUsePoints(6) } #self.contents.draw_text(1, -8, 128, 32, "Magias de classe")
@bttnfirew.mouse_move { CheckMove(1) }
@bttnearthw.mouse_move { CheckMove(2) }
@bttnwaterw.mouse_move { CheckMove(3) }
@bttnwindw.mouse_move { CheckMove(4) }
@bttndarkw.mouse_move { CheckMove(5) }
@bttnlightw.mouse_move { CheckMove(6) }
@bttnfirew.mouse_leave { WindowManager.closeWindow('Subtitle') }
@bttnearthw.mouse_leave { WindowManager.closeWindow('Subtitle') }
@bttnwaterw.mouse_leave { WindowManager.closeWindow('Subtitle') }
@bttnwindw.mouse_leave { WindowManager.closeWindow('Subtitle') }
@bttndarkw.mouse_leave { WindowManager.closeWindow('Subtitle') }
@bttnlightw.mouse_leave { WindowManager.closeWindow('Subtitle') }
#self.contents.draw_text(1, 46, 128, 32, "Magias colecionadas")
# @login = Button.new(self, 65, 140, 70, 20, Vocab::LoginButton) { login }
# def initialize(win, x, y, i, &b)
# def initialize(win, x, y, w, h, i)
# draw_icon(233, 1, 0)
# draw_icon(260, 1, 32)
# draw_icon(165, 1, 64)
# draw_icon(274, 1, 96)
refresh
end
def CheckMove(index)
WindowManager.showWindow('Subtitle')
if index == 1
WindowManager.Window('Subtitle').setStatus("Força", "Aumenta o dano de seu ataque básico máximo.")
elsif index == 2
WindowManager.Window('Subtitle').setStatus("Resistência", "Aumenta a quantidade de vida, a defesa física, e o dano mínimo.")
elsif index == 3
WindowManager.Window('Subtitle').setStatus("Sorte", "Aumenta a chance de causar danos críticos.")
elsif index == 4
WindowManager.Window('Subtitle').setStatus("Agilidade", "Aumenta a chance de se esquivar de ataques básicos.")
elsif index == 5
WindowManager.Window('Subtitle').setStatus("Inteligência", "Aumenta a quantidade de mana, e dano minímo e máximo de magias.")
elsif index == 6
WindowManager.Window('Subtitle').setStatus("Sabedoria", "Aumenta a regeneração de vida e a defesa mágica.")
end
end
def refresh
refresh_widgets
self.contents.clear
return if StructManager.Player($game_system.MyIndex).Equipment.nil?
srcrec = Rect.new(0, 0, 40, 40)
myclass = Constants::CLASSNAME[StructManager.Player($game_system.MyIndex).Class]
data = StructManager.Player($game_system.MyIndex).Equipment.split(",")
#self.contents.blt(86, 22, Cache.wing_hud("Small_#{myclass}_1_Face"), srcrec);
self.contents.font.size = 16
self.contents.font.name = ["Ubuntu Light"]
self.contents.draw_text(140, -4, 128, 32, "Profissões:")
self.contents.draw_text(1, -4, 128, 32, "Personagem:")
self.contents.draw_text(1, 12, 128, 32, StructManager.Player($game_system.MyIndex).Name)
self.contents.draw_text(1, 36, 128, 32, "Raça:")
self.contents.draw_text(1, 52, 128, 32, myclass)
self.contents.draw_text(1, 152, 128, 32, "Atributos:")
self.contents.font.color = $ColorRed
self.contents.draw_text(1, 170, 128, 32, "Força:")
self.contents.font.color = $ColorBrown
self.contents.draw_text(1, 186, 128, 32, "Resistência:")
self.contents.font.color = $ColorTurquoise
self.contents.draw_text(1, 202, 128, 32, "Sorte:")
self.contents.font.color = $ColorGreen
self.contents.draw_text(140, 170, 128, 32, "Agilidade:")
self.contents.font.color = $ColorYellow
self.contents.draw_text(140, 186, 128, 32, "Inteligência:")
self.contents.font.color = $ColorPink
self.contents.draw_text(140, 202, 128, 32, "Sabedoria:")
self.contents.font.color = $ColorWhite
self.contents.draw_text(36, 170, 128, 32, StructManager.Player($game_system.MyIndex).Fire)
self.contents.draw_text(63, 186, 128, 32, StructManager.Player($game_system.MyIndex).Earth)
self.contents.draw_text(36, 202, 128, 32, StructManager.Player($game_system.MyIndex).Water)
self.contents.draw_text(200, 170, 128, 32, StructManager.Player($game_system.MyIndex).Wind)
self.contents.draw_text(205, 186, 128, 32, StructManager.Player($game_system.MyIndex).Dark)
self.contents.draw_text(200, 202, 128, 32, StructManager.Player($game_system.MyIndex).Light)
self.contents.draw_text(1, 76, 128, 32, "Vitalidade:")
self.contents.draw_text(140, 92, 128, 32, "Regen/HP:")
self.contents.draw_text(140, 108, 128, 32, "Regen/MP:")
self.contents.draw_text(198, 92, 128, 32, StructManager.PlayerVitalityRegen($game_system.MyIndex))
self.contents.draw_text(198, 108, 128, 32, StructManager.PlayerSpiritRegen($game_system.MyIndex))
self.contents.draw_text(1, 92, 128, 32, "Espírito:")
self.contents.draw_text(46, 92, 128, 32, StructManager.PlayerMaxSpirit($game_system.MyIndex))
self.contents.draw_text(62, 76, 128, 32, StructManager.PlayerMaxVitality($game_system.MyIndex))
self.contents.draw_text(1, 124, 128, 32, "Pontos de atributo:")
self.contents.draw_text(106, 124, 128, 32, StructManager.Player($game_system.MyIndex).Points)
#@iconclass = IconButton.new(self, 122, 42, classicon.to_i, true, 255)
# draw_character(StructManager.Player($MyIndex.to_i).Sprite, StructManager.Player($MyIndex.to_i).Gender.to_i, 100, 70)
self.contents.draw_text(1, 108, 128, 32, "Experiência:")
self.contents.draw_text(64, 108, 128, 32, "#{StructManager.Player($game_system.MyIndex).Exp}/#{StructManager.ExpToNextLevel(StructManager.Player($game_system.MyIndex).Level)}")
###
#dmg
weapon = 0
helmet = 0
armor = 0
shield = 0
if !data[1].nil?
weapon = data[2].split(';')[0].to_i
level = data[2].split(';')[1].to_i
if weapon > 0
extramdmgweapon = $data_weapons[weapon].params[0] + (($data_weapons[weapon].params[0].to_f / 100.0) * (level * 7)).to_i
extradmgweapon = $data_weapons[weapon].params[2] + (($data_weapons[weapon].params[2].to_f / 100.0) * (level * 7)).to_i
extradefweapon = $data_weapons[weapon].params[3] + (($data_weapons[weapon].params[3].to_f / 100.0) * (level * 7)).to_i
extracritweapon = $data_weapons[weapon].params[7] + (($data_weapons[weapon].params[7].to_f / 100.0) * (level * 7)).to_i
extraesqweapon = $data_weapons[weapon].params[6] + (($data_weapons[weapon].params[6].to_f / 100.0) * (level * 7)).to_i
extrammagweapon = $data_weapons[weapon].params[1] + (($data_weapons[weapon].params[1].to_f / 100.0) * (level * 7)).to_i
extramagweapon = $data_weapons[weapon].params[4] + (($data_weapons[weapon].params[4].to_f / 100.0) * (level * 7)).to_i
extramdefweapon = $data_weapons[weapon].params[5] + (($data_weapons[weapon].params[5].to_f / 100.0) * (level * 7)).to_i
end
helmet = data[0].split(';')[0].to_i
level = data[0].split(';')[1].to_i
if helmet > 0
extradmghelmet = $data_armors[helmet].params[2] + (($data_armors[helmet].params[2].to_f / 100.0) * (level * 7)).to_i
extradefhelmet = $data_armors[helmet].params[3] + (($data_armors[helmet].params[3].to_f / 100.0) * (level * 7)).to_i
extramdmghelmet = $data_armors[helmet].params[0] + (($data_armors[helmet].params[0].to_f / 100.0) * (level * 7)).to_i
extracrithelmet = $data_armors[helmet].params[7] + (($data_armors[helmet].params[7].to_f / 100.0) * (level * 7)).to_i
extraesqhelmet = $data_armors[helmet].params[6] + (($data_armors[helmet].params[6].to_f / 100.0) * (level * 7)).to_i
extrammaghelmet = $data_armors[helmet].params[1] + (($data_armors[helmet].params[1].to_f / 100.0) * (level * 7)).to_i
extramaghelmet = $data_armors[helmet].params[4] + (($data_armors[helmet].params[4].to_f / 100.0) * (level * 7)).to_i
extramdefhelmet = $data_armors[helmet].params[5] + (($data_armors[helmet].params[5].to_f / 100.0) * (level * 7)).to_i
end
armor = data[1].split(';')[0].to_i
level = data[1].split(';')[1].to_i
if armor > 0
extradmgarmor = $data_armors[armor].params[2] + (($data_armors[armor].params[2].to_f / 100.0) * (level * 7)).to_i
extradefarmor = $data_armors[armor].params[3] + (($data_armors[armor].params[3].to_f / 100.0) * (level * 7)).to_i
extramdmgarmor = $data_armors[armor].params[0] + (($data_armors[armor].params[0].to_f / 100.0) * (level * 7)).to_i
extracritarmor = $data_armors[armor].params[7] + (($data_armors[armor].params[7].to_f / 100.0) * (level * 7)).to_i
extraesqarmor = $data_armors[armor].params[6] + (($data_armors[armor].params[6].to_f / 100.0) * (level * 7)).to_i
extrammagarmor = $data_armors[armor].params[1] + (($data_armors[armor].params[1].to_f / 100.0) * (level * 7)).to_i
extramagarmor = $data_armors[armor].params[4] + (($data_armors[armor].params[4].to_f / 100.0) * (level * 7)).to_i
extramdefarmor = $data_armors[armor].params[5] + (($data_armors[armor].params[5].to_f / 100.0) * (level * 7)).to_i
end
shield = data[3].split(';')[0].to_i
level = data[3].split(';')[1].to_i
if shield > 0
extradmgshield = $data_armors[shield].params[2] + (($data_armors[shield].params[2].to_f / 100.0) * (level * 7)).to_i
extradefshield = $data_armors[shield].params[3] + (($data_armors[shield].params[3].to_f / 100.0) * (level * 7)).to_i
extramdmgshield = $data_armors[shield].params[0] + (($data_armors[shield].params[0].to_f / 100.0) * (level * 7)).to_i
extracritshield = $data_armors[shield].params[7] + (($data_armors[shield].params[7].to_f / 100.0) * (level * 7)).to_i
extraesqshield = $data_armors[shield].params[6] + (($data_armors[shield].params[6].to_f / 100.0) * (level * 7)).to_i
extrammagshield = $data_armors[shield].params[1] + (($data_armors[shield].params[1].to_f / 100.0) * (level * 7)).to_i
extramagshield = $data_armors[shield].params[4] + (($data_armors[shield].params[4].to_f / 100.0) * (level * 7)).to_i
extramdefshield = $data_armors[shield].params[5] + (($data_armors[shield].params[5].to_f / 100.0) * (level * 7)).to_i
end
end
###
self.contents.draw_text(1, 222, 128, 32, "Ataque Básico:")
extradmgshield = 0 if extradmgshield.nil?
extradmgarmor = 0 if extradmgarmor.nil?
extradmgweapon = 0 if extradmgweapon.nil?
extradmghelmet = 0 if extradmghelmet.nil?
extramdmgshield = 0 if extramdmgshield.nil?
extramdmgarmor = 0 if extramdmgarmor.nil?
extramdmgweapon = 0 if extramdmgweapon.nil?
extramdmghelmet = 0 if extramdmghelmet.nil?
minatq = (StructManager.Player($game_system.MyIndex).Earth.to_f * 0.7) + extramdmgshield + extramdmgarmor + extramdmghelmet + extramdmgweapon
maxatq = (StructManager.Player($game_system.MyIndex).Fire.to_f * 1.8) + extradmgshield + extradmgarmor + extradmghelmet + extradmgweapon
if StructManager.Player($game_system.MyIndex).Class == 6
for i in 1..16
if !StructManager.Skill(i).nil?
if StructManager.Skill(i).num == 39 && StructManager.Skill(i).level > 0
minatq = (StructManager.Player($game_system.MyIndex).Wind.to_f * 0.7) + extramdmgshield + extramdmgarmor + extramdmghelmet + extramdmgweapon
maxatq = (StructManager.Player($game_system.MyIndex).Wind.to_f * 1.8) + extradmgshield + extradmgarmor + extradmghelmet + extradmgweapon
minatq += (StructManager.Player($game_system.MyIndex).Earth.to_f * 0.7)
maxatq += (StructManager.Player($game_system.MyIndex).Fire.to_f * 1.8)
end
end
end
end
if StructManager.Player($game_system.MyIndex).Class == 5
for i in 1..16
if !StructManager.Skill(i).nil?
if StructManager.Skill(i).num == 35 && StructManager.Skill(i).level > 0
minatq = (StructManager.Player($game_system.MyIndex).Earth.to_f * 0.7) + extramdmgshield + extramdmgarmor + extramdmghelmet + extramdmgweapon
maxatq = (StructManager.Player($game_system.MyIndex).Earth.to_f * 1.8) + extradmgshield + extradmgarmor + extradmghelmet + extradmgweapon
minatq += (StructManager.Player($game_system.MyIndex).Fire.to_f * 0.7)
maxatq += (StructManager.Player($game_system.MyIndex).Fire.to_f * 1.8)
end
end
end
end
if StructManager.Player($game_system.MyIndex).SORE
minatq = minatq / 2
maxatq = maxatq / 2
end
self.contents.draw_text(80, 222, 128, 32, "#{minatq.to_i}~#{maxatq.to_i}")
self.contents.draw_text(1, 238, 128, 32, "Resistência Física:")
extradefshield = 0 if extradefshield.nil?
extradefarmor = 0 if extradefarmor.nil?
extradefweapon = 0 if extradefweapon.nil?
extradefhelmet = 0 if extradefhelmet.nil?
defense = (StructManager.Player($game_system.MyIndex).Earth.to_f * 0.05) + extradefshield + extradefarmor + extradefhelmet + extradefweapon
if StructManager.Player($game_system.MyIndex).SORE
defense = defense / 2
end
self.contents.draw_text(95, 238, 128, 32, "#{defense.to_i}%")
self.contents.draw_text(140, 222, 128, 32, "Esquiva:")
extraesqshield = 0 if extraesqshield.nil?
extraesqarmor = 0 if extraesqarmor.nil?
extraesqweapon = 0 if extraesqweapon.nil?
extraesqhelmet = 0 if extraesqhelmet.nil?
dodge = (StructManager.Player($game_system.MyIndex).Wind.to_f * 0.3) + extraesqshield + extraesqarmor + extraesqhelmet + extraesqweapon
if StructManager.Player($game_system.MyIndex).SORE
dodge = dodge / 2
end
self.contents.draw_text(186, 222, 128, 32, "#{dodge.round(1)}")
self.contents.draw_text(140, 238, 128, 32, "Ataque Mágico:")
extrammagshield = 0 if extrammagshield.nil?
extrammagarmor = 0 if extrammagarmor.nil?
extrammagweapon = 0 if extrammagweapon.nil?
extrammaghelmet = 0 if extrammaghelmet.nil?
extramagshield = 0 if extramagshield.nil?
extramagarmor = 0 if extramagarmor.nil?
extramagweapon = 0 if extramagweapon.nil?
extramaghelmet = 0 if extramaghelmet.nil?
mindark = StructManager.Player($game_system.MyIndex).Dark.to_f * 0.1 + extrammagshield + extrammagarmor + extrammaghelmet + extrammagweapon
maxdark = StructManager.Player($game_system.MyIndex).Dark.to_f * 1.5 + extramagshield + extramagarmor + extramaghelmet + extramagweapon
if StructManager.Player($game_system.MyIndex).Class == 6
for i in 1..16
if !StructManager.Skill(i).nil?
if StructManager.Skill(i).num == 39 && StructManager.Skill(i).level > 0
mindark = StructManager.Player($game_system.MyIndex).Wind.to_f * 0.1 + extrammagshield + extrammagarmor + extrammaghelmet + extrammagweapon
maxdark = StructManager.Player($game_system.MyIndex).Wind.to_f * 1.5 + extramagshield + extramagarmor + extramaghelmet + extramagweapon
end
end
end
end
if StructManager.Player($game_system.MyIndex).Class == 5
for i in 1..16
if !StructManager.Skill(i).nil?
if StructManager.Skill(i).num == 35 && StructManager.Skill(i).level > 0
mindark = StructManager.Player($game_system.MyIndex).Earth.to_f * 0.1 + extrammagshield + extrammagarmor + extrammaghelmet + extrammagweapon
maxdark = StructManager.Player($game_system.MyIndex).Earth.to_f * 1.5 + extramagshield + extramagarmor + extramaghelmet + extramagweapon
end
end
end
end
if StructManager.Player($game_system.MyIndex).Class == 1
for i in 1..16
if !StructManager.Skill(i).nil?
if StructManager.Skill(i).num == 46 && StructManager.Skill(i).level > 0
mindark += (mindark / 100) * 10
maxdark += (maxdark / 100) * 10
end
end
end
end
if StructManager.Player($game_system.MyIndex).SORE
mindark = mindark / 2
maxdark = maxdark / 2
end
self.contents.draw_text(222, 238, 128, 32, "#{mindark.to_i}~#{maxdark.to_i}")
self.contents.draw_text(1, 254, 128, 32, "Crítico:")
extracritshield = 0 if extracritshield.nil?
extracritarmor = 0 if extracritarmor.nil?
extracritweapon = 0 if extracritweapon.nil?
extracrithelmet = 0 if extracrithelmet.nil?
critical = (StructManager.Player($game_system.MyIndex).Water.to_f * 0.2) + extracritshield + extracritarmor + extracrithelmet + extracritweapon
if StructManager.Player($game_system.MyIndex).Class == 4
for i in 1..16
if !StructManager.Skill(i).nil?
if StructManager.Skill(i).num == 48 && StructManager.Skill(i).level > 0
critical += StructManager.Skill(i).level * 1.5
end
end
end
end
if StructManager.Player($game_system.MyIndex).SORE
critical = critical / 2
end
self.contents.draw_text(41, 254, 128, 32, "#{critical.round(1)}")
self.contents.draw_text(140, 254, 128, 32, "Resistência Mágica:")
extramdefshield = 0 if extramdefshield.nil?
extramdefarmor = 0 if extramdefarmor.nil?
extramdefweapon = 0 if extramdefweapon.nil?
extramdefhelmet = 0 if extramdefhelmet.nil?
defm = (StructManager.Player($game_system.MyIndex).Light.to_f * 0.05) + extramdefshield + extramdefarmor + extramdefhelmet + extramdefweapon
if StructManager.Player($game_system.MyIndex).SORE
defm = defm / 2
end
self.contents.draw_text(242, 254, 128, 32, "#{defm.to_i}%")
if StructManager.Player($game_system.MyIndex).Points.to_i >= 1
return if @bttnfire.nil?
@bttnfire.set_visibility(true) if !@bttnfire.visibility?
@bttnearth.set_visibility(true) if !@bttnearth.visibility?
@bttnwater.set_visibility(true) if !@bttnwater.visibility?
@bttnwind.set_visibility(true) if !@bttnwind.visibility?
@bttndark.set_visibility(true) if !@bttndark.visibility?
@bttnlight.set_visibility(true) if !@bttnlight.visibility?
@bttnfirew.set_visibility(true) if !@bttnfirew.visibility?
@bttnearthw.set_visibility(true) if !@bttnearthw.visibility?
@bttnwaterw.set_visibility(true) if !@bttnwaterw.visibility?
@bttnwindw.set_visibility(true) if !@bttnwindw.visibility?
@bttndarkw.set_visibility(true) if !@bttndarkw.visibility?
@bttnlightw.set_visibility(true) if !@bttnlightw.visibility?
else
@bttnfire.set_visibility(false) if @bttnfire.visibility?
@bttnearth.set_visibility(false) if @bttnearth.visibility?
@bttnwater.set_visibility(false) if @bttnwater.visibility?
@bttnwind.set_visibility(false) if @bttnwind.visibility?
@bttndark.set_visibility(false) if @bttndark.visibility?
@bttnlight.set_visibility(false) if @bttnlight.visibility?
@bttnfirew.set_visibility(false) if @bttnfirew.visibility?
@bttnearthw.set_visibility(false) if @bttnearthw.visibility?
@bttnwaterw.set_visibility(false) if @bttnwaterw.visibility?
@bttnwindw.set_visibility(false) if @bttnwindw.visibility?
@bttndarkw.set_visibility(false) if @bttndarkw.visibility?
@bttnlightw.set_visibility(false) if @bttnlightw.visibility?
end
end
#--------------------------------------------------------------------------
# * Aquisição da largura da janela
#--------------------------------------------------------------------------
def window_width
Graphics.width / 2
end
#--------------------------------------------------------------------------
# * Aquisição da altura da janela
#--------------------------------------------------------------------------
def window_height
fitting_height(11)
end
def hide(trink = false)
WindowManager.closeWindow('Job') if !trink
WindowManager.closeWindow('Subtitle') if WindowManager.Window('Subtitle').visible
super
end
end