PainelInfo = {} PainelInfo_Buttons = {} PainelInfo_VipInfo = {Level = 0, Date = "-"} PainelInfo_Scrollbar = {Offset = 0, InitSize = 153, Size = 0, MaxOffset = 0, Pos = 0, InitEsp = 153, Esp = 0, Multiplier = 0} PainelInfo_BtnDownListTimer = 0 PainelInfo_BtnDownListClicked = false PainelInfo_BtnUpListTimer = 0 PainelInfo_BtnUpListClicked = false PainelInfo_List = {} PainelInfo_ListaValores = {} PainelInfo_ListOffset = 0 function PainelInfo.Init() if PainelInfo_Ativado then InterfaceController.MainProcInterface(PainelInfo.Interface) InterfaceController.MainProcWorldKey(PainelInfo.KeyListener) InterfaceController.ScrollMouse(PainelInfo.Scroll) InterfaceController.InterfaceClickEvent(PainelInfo.ClickEvent) InterfaceController.ClientProtocol(PainelInfo.ClientProtocol) end end function PainelInfo.GerarLista() local count = 0 PainelInfo_List = {} for i in ipairs(PainelInfo_Saldo[getLanguage()]) do if i > PainelInfo_ListOffset then if count < 8 then local val = 0 if PainelInfo_ListaValores[PainelInfo_Saldo[getLanguage()][i].ListID] ~= nil then val = PainelInfo_ListaValores[PainelInfo_Saldo[getLanguage()][i].ListID] end table.insert(PainelInfo_List, {ListID = PainelInfo_Saldo[getLanguage()][i].ListID, Nome = PainelInfo_Saldo[getLanguage()][i].Name, Valor = val}) count = count+1 end end end end function PainelInfo.GerarBarra() if PainelInfo_Scrollbar.Offset > 0 then PainelInfo_Scrollbar.Offset = PainelInfo_Scrollbar.Offset - 1 PainelInfo_Scrollbar.Pos = PainelInfo_Scrollbar.Pos - PainelInfo_Scrollbar.Multiplier end PainelInfo_Scrollbar.MaxOffset = #PainelInfo_Saldo[getLanguage()]-8 if #PainelInfo_Saldo[getLanguage()] > 8 then PainelInfo_Scrollbar.Size = (PainelInfo_Scrollbar.InitSize - ((#PainelInfo_Saldo[getLanguage()]-8)*10)) if PainelInfo_Scrollbar.Size < 10 then PainelInfo_Scrollbar.Size = 10 end else PainelInfo_Scrollbar.Size = PainelInfo_Scrollbar.InitSize end PainelInfo_Scrollbar.Esp = PainelInfo_Scrollbar.InitEsp - PainelInfo_Scrollbar.Size PainelInfo_Scrollbar.Multiplier = PainelInfo_Scrollbar.Esp/(#PainelInfo_Saldo[getLanguage()]-8) end function PainelInfo.MoveBarDown() if PainelInfo_Scrollbar.Offset < PainelInfo_Scrollbar.MaxOffset then PainelInfo_Scrollbar.Offset = PainelInfo_Scrollbar.Offset + 1 PainelInfo_Scrollbar.Pos = PainelInfo_Scrollbar.Pos + PainelInfo_Scrollbar.Multiplier end end function PainelInfo.MoveBarUp() if PainelInfo_Scrollbar.Offset > 0 then PainelInfo_Scrollbar.Offset = PainelInfo_Scrollbar.Offset - 1 PainelInfo_Scrollbar.Pos = PainelInfo_Scrollbar.Pos - PainelInfo_Scrollbar.Multiplier end end function PainelInfo.AbrirJanela() CloseAllWindowsExcept(UICharacter) PainelInfo.GerarLista() PainelInfo.GerarBarra() UICustomInterface = PainelInfo_WindowID SetLockInterfaces() end function PainelInfo.FecharJanela() UICustomInterface = 0 SetUnlockInterfaces() PainelInfo_Scrollbar = {Offset = 0, InitSize = 153, Size = 0, MaxOffset = 0, Pos = 0, InitEsp = 153, Esp = 0, Multiplier = 0} PainelInfo_VipInfo = {Level = 0, Date = "-"} PainelInfo_List = {} PainelInfo_ListaValores = {} end function PainelInfo.CreateButton(IdBotao, X, Y, W, H) if PainelInfo_Buttons[IdBotao] == nil then table.insert(PainelInfo_Buttons, IdBotao) end PainelInfo_Buttons[IdBotao] = {X1 = X, X2 = X+W, Y1 = Y, Y2 = Y+H} end function PainelInfo.CheckButton(IdBotao, X, Y) if PainelInfo_Buttons[IdBotao] == nil then return false end if X >= PainelInfo_Buttons[IdBotao].X1 and X <= PainelInfo_Buttons[IdBotao].X2 and Y >= PainelInfo_Buttons[IdBotao].Y1 and Y <= PainelInfo_Buttons[IdBotao].Y2 then return true end return false end function PainelInfo.GetSaldo() CreatePacket("PI_GetSaldo", PainelInfo_Packet) SendPacket("PI_GetSaldo") ClearPacket("PI_GetSaldo") return end function PainelInfo.Interface() if CheckWindowOpen(UICharacter) == 1 then -- janela de personagem nativa em (450,0): botoes nativos em y=395 x 473/503/533 -> o nosso em 566 PainelInfo.CreateButton(4, 566, 395, 23, 23) -- (botao 5 do pack ficava em 475 = em cima do "sair" nativo: removido) if UICustomInterface == PainelInfo_WindowID then CreateInterface(PainelInfo_Images[9], 566, 395, 23, 23, 0, 0, 0.75, 0.75, 1, 1) else CreateInterface(PainelInfo_Images[8], 566, 395, 23, 23, 0, 0, 0.75, 0.75, 1, 1) end if PainelInfo.CheckButton(4, MousePosX(), MousePosY()) then SetFont(0) SetTextBackColor(0, 0, 0, 200) SetTextColor(255, 255, 255, 235) SetText(550, 380, string.format(PainelInfo_Texts[getLanguage()][7])) end end if UICustomInterface == PainelInfo_WindowID then local margin = 0 if CheckWindowOpen(UICharacter) == 1 then margin = 190 end EnableAlphaTest(1) CreateInterface(PainelInfo_Images[1], 450-margin, 0, 190, 256, 0, 0, 0.7424124, 1, 1,1) CreateInterface(PainelInfo_Images[2], 450-margin, 256, 190, 177, 0, 0, 0.7424124, 0.6918124, 1,1) CreateInterface(IMG_EXIT, 470-margin, 395, 24, 24, 0, 0, 0.75, 0.75, 1, 1) PainelInfo.CreateButton(1, 470-margin, 395, 24, 24) if PainelInfo.CheckButton(1, MousePosX(), MousePosY()) then SetFont(0) SetTextBackColor(0, 0, 0, 255) SetTextColor(255, 255, 255, 255) SetText(469-margin, 383, string.format(PainelInfo_Texts[getLanguage()][2])) end SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 255, 255, 255) SetText2(546-margin, 15, string.format(PainelInfo_Texts[getLanguage()][1])) SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(0, 207, 207, 250) SetText2(545-margin, 63, string.format(PainelInfo_Texts[getLanguage()][3])) SetText2(545-margin, 175, string.format(PainelInfo_Texts[getLanguage()][4])) SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(250, 208, 0, 255) SetText(485-margin, 90, string.format(PainelInfo_Texts[getLanguage()][5])) SetText(485-margin, 115, string.format(PainelInfo_Texts[getLanguage()][6])) SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 255, 255, 255) SetText2(570-margin, 90, string.format(PainelInfo_VipNames[getLanguage()][PainelInfo_VipInfo.Level])) SetText2(570-margin, 115, string.format(PainelInfo_VipInfo.Date)) DisableAlphaBlend() SetBlend() glColor4f(0.37, 0.3317, 0.2849, 1.0) DrawBar(599-margin, 192, 15, 180) glColor4f(0.91, 0.875, 0.8099, 1.0) DrawBar(600-margin, 205+PainelInfo_Scrollbar.Pos, 12, PainelInfo_Scrollbar.Size) glColor4f(0.17, 0.1353, 0.1088, 1.0) DrawBar(612-margin, 205+PainelInfo_Scrollbar.Pos, 1, PainelInfo_Scrollbar.Size) DrawBar(600-margin, (205+PainelInfo_Scrollbar.Pos+PainelInfo_Scrollbar.Size), 13, 1) glColor4f(0.39, 0.3504, 0.3081, 0.6) DrawBar(601-margin, 206+PainelInfo_Scrollbar.Pos, 11, (PainelInfo_Scrollbar.Size-1)) glColor4f(0.3, 0.3, 0.3, 0.5) local linha = 213 for i = 1, #PainelInfo_List-1 do DrawBar(480-margin, linha, 115, 1) linha = linha + 22 end GLSwitchBlend() glColor3f(1.0, 1.0, 1.0) GLSwitch() EnableAlphaTest(1) SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 255, 255, 255) local linha = 213 for i in ipairs (PainelInfo_List) do SetText(490-margin, linha-15, string.format("%s: %d", PainelInfo_List[i].Nome, PainelInfo_List[i].Valor)) CreateInterface(PainelInfo_Images[7], 480-margin, linha-13, 5, 5, 0, 0, 0.591827401425252121, 0.591827401425252121, 1, 1) linha = linha + 22 end if PainelInfo_BtnUpListClicked then if PainelInfo_BtnUpListTimer >= 2 then PainelInfo_BtnUpListTimer = 0 PainelInfo_BtnUpListClicked = false end CreateInterface(PainelInfo_Images[4], 600-margin, 193, 13, 12, 0, 0, 0.687676, 0.687676, 1,1) PainelInfo_BtnUpListTimer = PainelInfo_BtnUpListTimer + 1 else PainelInfo.CreateButton(2, 600-margin, 193, 13, 12) CreateInterface(PainelInfo_Images[3], 600-margin, 193, 13, 12, 0, 0, 0.687676, 0.687676, 1,1) end if PainelInfo_BtnDownListClicked then if PainelInfo_BtnDownListTimer >= 2 then PainelInfo_BtnDownListTimer = 0 PainelInfo_BtnDownListClicked = false end CreateInterface(PainelInfo_Images[6], 600-margin, 359, 13, 12, 0, 0, 0.687676, 0.687676, 1,1) PainelInfo_BtnDownListTimer = PainelInfo_BtnDownListTimer + 1 else PainelInfo.CreateButton(3, 600-margin, 359, 13, 12) CreateInterface(PainelInfo_Images[5], 600-margin, 359, 13, 12, 0, 0, 0.687676, 0.687676, 1,1) end DisableAlphaBlend() end end function PainelInfo.Scroll(Direction) local x = MousePosX() local y = MousePosY() if UICustomInterface == PainelInfo_WindowID then end end function PainelInfo.ClickEvent() local x = MousePosX() local y = MousePosY() if UICustomInterface == PainelInfo_WindowID then if PainelInfo.CheckButton(1, MousePosX(), MousePosY()) then PainelInfo.FecharJanela() return true end if PainelInfo.CheckButton(2, x, y) then if PainelInfo_ListOffset > 0 then PainelInfo_ListOffset = PainelInfo_ListOffset - 1 PainelInfo.GerarLista() end PainelInfo_BtnUpListClicked = true PainelInfo.MoveBarUp() return true end if PainelInfo.CheckButton(3, x, y) then if #PainelInfo_Saldo[getLanguage()] > 8 then if #PainelInfo_Saldo[getLanguage()]-PainelInfo_ListOffset > 8 then PainelInfo_ListOffset = PainelInfo_ListOffset + 1 PainelInfo.GerarLista() end end PainelInfo_BtnDownListClicked = true PainelInfo.MoveBarDown() return true end end if CheckWindowOpen(UICharacter) == 1 then if PainelInfo.CheckButton(4, x, y) then if UICustomInterface == PainelInfo_WindowID then PainelInfo.FecharJanela() else PainelInfo.GetSaldo() PainelInfo.AbrirJanela() end end end end function PainelInfo.KeyListener(key) if PainelInfo_Shortcut ~= -1 then if key == PainelInfo_Shortcut then if CheckWindowOpen(UIStore) == 0 and GetChatPlayerOpen() == 0 then if UICustomInterface == 0 then PainelInfo.GetSaldo() PainelInfo.AbrirJanela() return true end if UICustomInterface == PainelInfo_WindowID then PainelInfo.FecharJanela() return true end end end end if key == Keys.Escape then if UICustomInterface == PainelInfo_WindowID then PainelInfo.FecharJanela() return true end end end function PainelInfo.ClientProtocol(Packet, PacketName) if Packet == PainelInfo_Packet then if PacketName == "PI_Abrir" then local vip = GetBytePacket(PacketName, -1) local vencimento = GetDwordPacket(PacketName, -1) PainelInfo_VipInfo.Level = vip if vip > 0 then local str = "%d/%m/%Y" if getLanguage() == "Eng" then str = "%m/%d/%Y" end PainelInfo_VipInfo.Date = os.date(str, vencimento) end PainelInfo_ListaValores = {} local qtd = GetBytePacket(PacketName, -1) for i = 1, qtd do local listid = GetBytePacket(PacketName, -1) local valor = GetDwordPacket(PacketName, -1) PainelInfo_ListaValores[listid] = valor end ClearPacket(PacketName) PainelInfo.GerarLista() return true end end end PainelInfo.Init() return PainelInfo