GiroDaSorte = {} -- rotulo escuro centralizado sobre uma placa IMG_BTN function GiroBtnLabel(x, y, w, h, label) SetFont(1) SetTextBackColor(0, 0, 0, 0) SetTextColor(30, 30, 30, 255) local tw = string.len(label or "") * 6 SetText(math.floor(x + (w - tw) / 2), math.floor(y + (h - 10) / 2), label or "") SetFont(0) end Giro_BtnText = { ["Eng"] = { "OK", "Cancel" }, ["Por"] = { "OK", "Cancelar" }, ["Spn"] = { "OK", "Cancelar" } } -- nome real do item (lista do cliente) + nivel, em vez do nome generico do config function GiroDaSorte.NomeItem(item) if item == nil or type(item) ~= "table" then return "" end local nome = GetNameByIndex(GET_ITEM(item.Grupo, item.Id)) if nome == nil or nome == "" then nome = item.Nome or "" end if (item.Level or 0) > 0 then nome = nome .. " +" .. item.Level end return nome end local Giro_ItemSorteado = false local Giro_ItemSorteadoListID = -1 local Giro_BtnUpListClicked = false local Giro_BtnUpListTimer = 0 local Giro_BtnDownListClicked = false local Giro_BtnDownListTimer = 0 local Giro_Vip = 0 local Giro_Index = 1 local Giro_ListaItens = {} local Giro_ListaItensOffset = 1 local Giro_AnimationTimer = 0 local Giro_Animation = false local Giro_ItemTemp = false local Giro_ShowWindowSuccess = false local Giro_ShowWindowNoSpace = false local Giro_ShowAlertClose = false local Giro_ShowWindowNoBalance = false local Giro_ShowWindowConfirm = false local Giro_Buttons = {} local Giro_ItemBar = {Offset = 0, InitSize = 80, Size = 0, MaxOffset = 0, Pos = 0, InitEsp = 80, Esp = 0, Multiplier = 0} function GiroDaSorte.Init() if Giro_Ativado then InterfaceController.MainProcInterface(GiroDaSorte.Interface) InterfaceController.MainProcWorldKey(GiroDaSorte.KeyListener) InterfaceController.ScrollMouse(GiroDaSorte.Scroll) InterfaceController.InterfaceClickEvent(GiroDaSorte.ClickEvent) InterfaceController.ClientProtocol(GiroDaSorte.ClientProtocol) math.randomseed(math.floor(os.clock() * os.time() / 40353607)) end end function GiroDaSorte.GerarListaItens() local listcount = 0 Giro_ListaItens = {} for i in ipairs(Giro_Itens[Giro_Index]) do if i >= Giro_ListaItensOffset then if listcount < 5 then table.insert(Giro_ListaItens, Giro_Itens[Giro_Index][i]) listcount = listcount + 1 end end end end function GiroDaSorte.GerarBarra(Table, Bar, Lines) if Bar.Offset > 0 then Bar.Offset = Bar.Offset - 1 Bar.Pos = Bar.Pos - Bar.Multiplier end Bar.MaxOffset = #Table-Lines if #Table > Lines then Bar.Size = (Bar.InitSize - ((#Table-Lines)*10)) if Bar.Size < 10 then Bar.Size = 10 end else Bar.Size = Bar.InitSize end Bar.Esp = Bar.InitEsp - Bar.Size Bar.Multiplier = Bar.Esp/(#Table-Lines) end function GiroDaSorte.MoveBarDown(Bar) if Bar.Offset < Bar.MaxOffset then Bar.Offset = Bar.Offset + 1 Bar.Pos = Bar.Pos + Bar.Multiplier end end function GiroDaSorte.MoveBarUp(Bar) if Bar.Offset > 0 then Bar.Offset = Bar.Offset - 1 Bar.Pos = Bar.Pos - Bar.Multiplier end end function GiroDaSorte.CreateButton(IdBotao, Index, X, Y, W, H, AX, AY) if Index > -1 then CreateInterface(Index, X, Y, W, H, 0, 0, AX, AY, 1, 1) end if Giro_Buttons[IdBotao] == nil then table.insert(Giro_Buttons, IdBotao) end Giro_Buttons[IdBotao] = {X1 = X, X2 = X+W, Y1 = Y, Y2 = Y+H} end function GiroDaSorte.CheckButton(IdBotao, X, Y) if Giro_Buttons[IdBotao] == nil then return false end if X >= Giro_Buttons[IdBotao].X1 and X <= Giro_Buttons[IdBotao].X2 and Y >= Giro_Buttons[IdBotao].Y1 and Y <= Giro_Buttons[IdBotao].Y2 then return true end return false end function GiroDaSorte.Interface() if UICustomInterface == Giro_WindowID then -- S3: NAO abrir UIOtherStore (loja pessoal) - era so um "fundo" no S6 e -- aqui dispara pacotes de PShop que derrubam a conexao. OpenWindow(UIInventory) CloseWindow(UICharacter) EnableAlphaTest(1) if MousePosX() >= 450 and MousePosX() <= 640 and MousePosY() >= 0 and MousePosY() <= 365 then SetUnlockInterfaces() else SetLockInterfaces() end CreateInterface(Giro_Images[1], 260, 0, 190, 256, 0, 0, 0.7424124, 1, 1,1) CreateInterface(Giro_Images[2], 260, 256, 190, 177, 0, 0, 0.7424124, 0.6918124, 1,1) -- (GS_Inv_Fix cobria a parte de baixo do inventario nativo - removido no S3) SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(0, 251, 255, 255) SetText2(355, 15, string.format(Giro_Texts[getLanguage()][1])) GiroDaSorte.CreateButton(1, -1, 470, 395, 24, 24, 0, 0) if GiroDaSorte.CheckButton(1, MousePosX(), MousePosY()) then SetFont(0) SetTextBackColor(0, 0, 0, 255) SetTextColor(255, 255, 255, 255) SetText(469, 383, Giro_Texts[getLanguage()][2]) end if not Giro_Animation then if Giro_ItemSorteado and Giro_ItemSorteadoListID ~= 0 then SetFont(1) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 208, 0, 255) SetText2(355, 50, string.format(Giro_Texts[getLanguage()][3])) SetFont(0) SetTextColor(255, 255, 255, 255) SetText2(355, 75, string.format(Giro_Texts[getLanguage()][4])) SetTextColor(255, 208, 0, 255) SetText2(355, 90, string.format(Giro_Texts[getLanguage()][5], GiroDaSorte.NomeItem(Giro_ItemSorteado))) else SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 208, 0, 255) SetText2(355, 55, string.format(Giro_Texts[getLanguage()][6])) SetTextColor(255, 255, 255, 255) SetText2(355, 75, string.format(Giro_Texts[getLanguage()][7])) SetText2(355, 85, string.format(Giro_Texts[getLanguage()][8], Giro_Moeda[Giro_Index].Valor, Giro_Moeda[Giro_Index].Nome)) SetText2(355, 100, string.format(Giro_Texts[getLanguage()][9])) end else SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 208, 0, 255) SetText2(355, 55, string.format(Giro_Texts[getLanguage()][6])) SetTextColor(255, 255, 255, 255) SetText2(355, 75, string.format(Giro_Texts[getLanguage()][7])) SetText2(355, 85, string.format(Giro_Texts[getLanguage()][8], Giro_Moeda[Giro_Index].Valor, Giro_Moeda[Giro_Index].Nome)) SetText2(355, 100, string.format(Giro_Texts[getLanguage()][9])) end SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 208, 0, 220) SetText2(355, 275, string.format(Giro_Texts[getLanguage()][10])) SetTextBackColor(255, 0, 0, 120) SetTextColor(255, 255, 255, 255) SetText2(355, 398, string.format(Giro_Texts[getLanguage()][11], Giro_PorcentagemTroll[Giro_Index][Giro_Vip]).."% ") GiroDaSorte.CreateButton(2, Giro_Images[4], 306, 237, 100, 20, 0.58627121, 0.76027121) if GiroDaSorte.CheckButton(2, MousePosX(), MousePosY()) then CreateInterface(Giro_Images[5], 306, 237, 100, 20, 0, 0, 0.58627121, 0.76027121, 1, 1) end SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 255, 255, 255) if not Giro_ItemSorteado then SetText2(355, 242, string.format(Giro_Texts[getLanguage()][12])) else if Giro_Animation then SetText2(355, 242, string.format(Giro_Texts[getLanguage()][13])) else if Giro_ItemSorteadoListID >= 1 then SetText2(355, 242, string.format(Giro_Texts[getLanguage()][14])) else SetText2(355, 242, string.format(Giro_Texts[getLanguage()][15])) end end end DisableAlphaBlend() SetBlend() glColor4f(0.37, 0.3317, 0.2849, 1.0) DrawBar(411, 290, 14, 102) glColor4f(0.91, 0.875, 0.8099, 1.0) DrawBar(412, 304+Giro_ItemBar.Pos, 12, Giro_ItemBar.Size) glColor4f(0.39, 0.3504, 0.3081, 0.6) DrawBar(413, 305+Giro_ItemBar.Pos, 11, Giro_ItemBar.Size) glColor4f(0.3, 0.3, 0.3, 0.5) local linha = 309 for i = 1, #Giro_ListaItens-1 do DrawBar(290, linha, 115, 1) linha = linha + 20 end if not Giro_Animation then local linha = 289 for i in ipairs(Giro_ListaItens) do if Giro_ItemSorteado then if Giro_ItemSorteadoListID ~= 0 then if Giro_ItemSorteado.ListID == Giro_ListaItens[i].ListID then glColor4f(1.0, 1.0, 1.0, 0.1) DrawBar(290, linha+2, 115, 16) end end else if Giro_ItemTemp then if Giro_ItemTemp.ListID == Giro_ListaItens[i].ListID then glColor4f(1.0, 1.0, 1.0, 0.1) DrawBar(290, linha+2, 115, 16) end end end linha = linha + 20 end end GLSwitchBlend() glColor3f(1.0, 1.0, 1.0) GLSwitch() EnableAlphaTest(1) if Giro_BtnUpListClicked then if Giro_BtnUpListTimer >= 2 then Giro_BtnUpListTimer = 0 Giro_BtnUpListClicked = false end CreateInterface(Giro_Images[10], 412, 291, 13, 12, 0, 0, 0.687676, 0.687676, 1,1) Giro_BtnUpListTimer = Giro_BtnUpListTimer + 1 else GiroDaSorte.CreateButton(3, Giro_Images[9], 412, 291, 13, 12, 0.687676, 0.687676) end if Giro_BtnDownListClicked then if Giro_BtnDownListTimer >= 2 then Giro_BtnDownListTimer = 0 Giro_BtnDownListClicked = false end CreateInterface(Giro_Images[8], 412, 383, 13, 12, 0, 0, 0.687676, 0.687676, 1,1) Giro_BtnDownListTimer = Giro_BtnDownListTimer + 1 else GiroDaSorte.CreateButton(4, Giro_Images[7], 412, 383, 13, 12, 0.687676, 0.687676) end local linha = 296 for i in ipairs(Giro_ListaItens) do CreateInterface(Giro_Images[6], 290, linha+2, 5, 5, 0, 0, 0.591827401425252121, 0.591827401425252121, 1, 1) SetFont(0) SetTextBackColor(0, 0, 0, 0) if not Giro_Animation then if Giro_ItemSorteado then if Giro_ItemSorteadoListID ~= 0 then if Giro_ItemSorteado.ListID == Giro_ListaItens[i].ListID then SetTextColor(0, 255, 0, 200) else SetTextColor(255, 255, 255, 255) end else SetTextColor(255, 255, 255, 255) end else if Giro_ItemTemp then if Giro_ItemTemp.ListID == Giro_ListaItens[i].ListID then SetTextColor(0, 255, 0, 200) else SetTextColor(255, 255, 255, 255) end else SetTextColor(255, 255, 255, 255) end end else SetTextColor(255, 255, 255, 255) end SetText(300, linha, string.format(Giro_Texts[getLanguage()][16], GiroDaSorte.NomeItem(Giro_ListaItens[i]), Giro_ListaItens[i].Sucesso[Giro_Vip]).."%") linha = linha + 20 end if Giro_Animation then if Giro_ItemTemp then if Giro_AnimationTimer%2 == 0 then Giro_ItemTemp = Giro_Itens[Giro_Index][math.random(1, #Giro_Itens[Giro_Index])] end else Giro_ItemTemp = Giro_Itens[Giro_Index][math.random(1, #Giro_Itens[Giro_Index])] end DisableAlphaBlend() SetBlend() CreateItem(Giro_ItemTemp.Pos.X, Giro_ItemTemp.Pos.Y, Giro_ItemTemp.Pos.MX,Giro_ItemTemp.Pos.MY, GET_ITEM(Giro_ItemTemp.Grupo, Giro_ItemTemp.Id)) GLSwitchBlend() glColor3f(1.0, 1.0, 1.0) GLSwitch() EnableAlphaTest(1) if Giro_AnimationTimer >= 50 then if Giro_ItemSorteadoListID ~= 0 then GiroDaSorte.SoltarFogos() end Giro_AnimationTimer = 0 Giro_Animation = false else Giro_AnimationTimer = Giro_AnimationTimer + 1 end else if Giro_ItemSorteado then if Giro_ItemSorteadoListID >= 1 then DisableAlphaBlend() SetBlend() CreateItem(Giro_ItemSorteado.Pos.X, Giro_ItemSorteado.Pos.Y, Giro_ItemSorteado.Pos.MX,Giro_ItemSorteado.Pos.MY, GET_ITEM(Giro_ItemSorteado.Grupo, Giro_ItemSorteado.Id)) if not Giro_ShowAlertClose and not Giro_ShowWindowConfirm and not Giro_ShowWindowNoBalance and not Giro_ShowWindowNoSpace and not Giro_ShowWindowSuccess then if MousePosX() >= Giro_ItemSorteado.Pos.X and MousePosX() <= Giro_ItemSorteado.Pos.X+Giro_ItemSorteado.Pos.MX then if MousePosY() >= Giro_ItemSorteado.Pos.Y and MousePosY() <= Giro_ItemSorteado.Pos.Y+Giro_ItemSorteado.Pos.MY then local posy = MousePosY()+100 ShowItemDescription(MousePosX(), posy, GET_ITEM(Giro_ItemSorteado.Grupo, Giro_ItemSorteado.Id), Giro_ItemSorteado.Level, Giro_ItemSorteado.Skill, Giro_ItemSorteado.Luck, Giro_ItemSorteado.Option, Giro_ItemSorteado.Dur, Giro_ItemSorteado.Exc, 0) end end end GLSwitchBlend() glColor3f(1.0, 1.0, 1.0) GLSwitch() EnableAlphaTest(1) else SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 208, 0, 255) SetText2(355, 150, Giro_Texts[getLanguage()][17]) SetText2(355, 170, Giro_Texts[getLanguage()][18]) end else if Giro_ItemTemp then DisableAlphaBlend() SetBlend() CreateItem(Giro_ItemTemp.Pos.X, Giro_ItemTemp.Pos.Y, Giro_ItemTemp.Pos.MX,Giro_ItemTemp.Pos.MY, GET_ITEM(Giro_ItemTemp.Grupo, Giro_ItemTemp.Id)) if Giro_ShowItemDescription then if not Giro_ShowAlertClose and not Giro_ShowWindowConfirm and not Giro_ShowWindowNoBalance and not Giro_ShowWindowNoSpace and not Giro_ShowWindowSuccess then if MousePosX() >= Giro_ItemTemp.Pos.X and MousePosX() <= Giro_ItemTemp.Pos.X+Giro_ItemTemp.Pos.MX then if MousePosY() >= Giro_ItemTemp.Pos.Y and MousePosY() <= Giro_ItemTemp.Pos.Y+Giro_ItemTemp.Pos.MY then local posy = MousePosY()+100 ShowItemDescription(MousePosX(), posy, GET_ITEM(Giro_ItemTemp.Grupo, Giro_ItemTemp.Id), Giro_ItemTemp.Level, Giro_ItemTemp.Skill, Giro_ItemTemp.Luck, Giro_ItemTemp.Option, Giro_ItemTemp.Dur, Giro_ItemTemp.Exc, 0) end end end end GLSwitchBlend() glColor3f(1.0, 1.0, 1.0) GLSwitch() EnableAlphaTest(1) end end end if Giro_ShowWindowSuccess then CreateInterface(IMG_PANEL, 210, 70, 180, 70, 0, 0, 0.83203125, 1.0, 1, 1) GiroDaSorte.CreateButton(5, IMG_BTN, 275, 110, 50, 15, 0.875, 0.75) GiroBtnLabel(275, 110, 50, 15, (Giro_BtnText[getLanguage()] or Giro_BtnText["Eng"])[1]) if GiroDaSorte.CheckButton(5, MousePosX(), MousePosY()) then SetBlend() glColor4f(1.0, 1.0, 1.0, 0.15) DrawBar(275, 110, 50, 15) EndDrawBar() EnableAlphaTest(1) end SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 255, 255, 255) SetText2(300, 90, string.format(Giro_Texts[getLanguage()][19])) end if Giro_ShowWindowNoSpace then CreateInterface(IMG_PANEL, 210, 70, 180, 90, 0, 0, 0.83203125, 1.0, 1, 1) GiroDaSorte.CreateButton(5, IMG_BTN, 275, 125, 50, 15, 0.875, 0.75) GiroBtnLabel(275, 125, 50, 15, (Giro_BtnText[getLanguage()] or Giro_BtnText["Eng"])[1]) if GiroDaSorte.CheckButton(5, MousePosX(), MousePosY()) then SetBlend() glColor4f(1.0, 1.0, 1.0, 0.15) DrawBar(275, 125, 50, 15) EndDrawBar() EnableAlphaTest(1) end SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 250, 0, 255) SetText2(300, 82, string.format(Giro_Texts[getLanguage()][20])) SetTextColor(255, 255, 255, 255) SetText2(300, 92, string.format(Giro_Texts[getLanguage()][21])) SetText2(300, 102, string.format(Giro_Texts[getLanguage()][22])) end if Giro_ShowAlertClose then CreateInterface(IMG_PANEL, 210, 70, 180, 90, 0, 0, 0.83203125, 1.0, 1, 1) GiroDaSorte.CreateButton(5, IMG_BTN, 275, 125, 50, 15, 0.875, 0.75) GiroBtnLabel(275, 125, 50, 15, (Giro_BtnText[getLanguage()] or Giro_BtnText["Eng"])[1]) if GiroDaSorte.CheckButton(5, MousePosX(), MousePosY()) then SetBlend() glColor4f(1.0, 1.0, 1.0, 0.15) DrawBar(275, 125, 50, 15) EndDrawBar() EnableAlphaTest(1) end SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 250, 0, 255) SetText2(300, 82, string.format(Giro_Texts[getLanguage()][23])) SetTextColor(255, 255, 255, 255) SetText2(300, 92, string.format(Giro_Texts[getLanguage()][24])) SetText2(300, 102, string.format(Giro_Texts[getLanguage()][25])) end if Giro_ShowWindowNoBalance then CreateInterface(IMG_PANEL, 210, 70, 180, 70, 0, 0, 0.83203125, 1.0, 1, 1) GiroDaSorte.CreateButton(5, IMG_BTN, 275, 110, 50, 15, 0.875, 0.75) GiroBtnLabel(275, 110, 50, 15, (Giro_BtnText[getLanguage()] or Giro_BtnText["Eng"])[1]) if GiroDaSorte.CheckButton(5, MousePosX(), MousePosY()) then SetBlend() glColor4f(1.0, 1.0, 1.0, 0.15) DrawBar(275, 110, 50, 15) EndDrawBar() EnableAlphaTest(1) end SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 255, 255, 255) SetText2(300, 90, string.format(Giro_Texts[getLanguage()][26])) end if Giro_ShowWindowConfirm then CreateInterface(IMG_PANEL, 210, 70, 180, 70, 0, 0, 0.83203125, 1.0, 1, 1) GiroDaSorte.CreateButton(5, IMG_BTN, 240, 110, 50, 15, 0.875, 0.75) GiroBtnLabel(240, 110, 50, 15, (Giro_BtnText[getLanguage()] or Giro_BtnText["Eng"])[1]) if GiroDaSorte.CheckButton(5, MousePosX(), MousePosY()) then SetBlend() glColor4f(1.0, 1.0, 1.0, 0.15) DrawBar(240, 110, 50, 15) EndDrawBar() EnableAlphaTest(1) end GiroDaSorte.CreateButton(6, IMG_BTN, 310, 110, 50, 15, 0.875, 0.75) GiroBtnLabel(310, 110, 50, 15, (Giro_BtnText[getLanguage()] or Giro_BtnText["Eng"])[2]) if GiroDaSorte.CheckButton(6, MousePosX(), MousePosY()) then SetBlend() glColor4f(1.0, 1.0, 1.0, 0.15) DrawBar(310, 110, 50, 15) EndDrawBar() EnableAlphaTest(1) end SetFont(0) SetTextBackColor(0, 0, 0, 0) SetTextColor(255, 255, 255, 255) SetText2(300, 85, string.format(Giro_Texts[getLanguage()][27], Giro_Moeda[Giro_Index].Valor, Giro_Moeda[Giro_Index].Nome)) SetText2(300, 95, string.format(Giro_Texts[getLanguage()][28])) end DisableAlphaBlend() end end function GiroDaSorte.KeyListener(key) if UICustomInterface == Giro_WindowID then if key == 27 or key == 86 or key == 73 then if not Giro_ShowAlertClose and not Giro_ShowWindowConfirm and not Giro_ShowWindowNoBalance and not Giro_ShowWindowNoSpace and not Giro_ShowWindowSuccess then if Giro_ItemSorteado then if Giro_ItemSorteadoListID ~= 0 then Giro_ShowAlertClose = true else GiroDaSorte.FecharJanela() end else GiroDaSorte.FecharJanela() end end end return true end end function GiroDaSorte.Scroll(Direction) local x = MousePosX() local y = MousePosY() if UICustomInterface == Giro_WindowID then if x >= 283 and x <= 428 and y >= 202 and y <= 409 then if Direction > 0 then if Giro_ListaItensOffset > 1 then Giro_ListaItensOffset = Giro_ListaItensOffset - 1 GiroDaSorte.GerarListaItens() GiroDaSorte.MoveBarUp(Giro_ItemBar) end return true else if #Giro_Itens[Giro_Index] > 5 then if #Giro_Itens[Giro_Index]-Giro_ListaItensOffset >= 5 then Giro_ListaItensOffset = Giro_ListaItensOffset + 1 GiroDaSorte.GerarListaItens() GiroDaSorte.MoveBarDown(Giro_ItemBar) end end return true end return true end end end function GiroDaSorte.ClickEvent() local x = MousePosX() local y = MousePosY() if UICustomInterface == Giro_WindowID then if not Giro_ShowAlertClose and not Giro_ShowWindowConfirm and not Giro_ShowWindowNoBalance and not Giro_ShowWindowNoSpace and not Giro_ShowWindowSuccess then if GiroDaSorte.CheckButton(1, x, y) then if Giro_ItemSorteado then if Giro_ItemSorteadoListID ~= 0 then Giro_ShowAlertClose = true return true else GiroDaSorte.FecharJanela() end else GiroDaSorte.FecharJanela() end return true end if GiroDaSorte.CheckButton(2, x, y) then if not Giro_Animation then if not Giro_ItemSorteado then Giro_ShowWindowConfirm = true else if Giro_ItemSorteadoListID == 0 then Giro_ItemSorteadoListID = false Giro_ItemSorteado = false Giro_ItemTemp = false Giro_ShowWindowConfirm = true else GiroDaSorte.RetirarItem() end end end return true end if GiroDaSorte.CheckButton(3, x, y) then if Giro_ListaItensOffset > 1 then Giro_ListaItensOffset = Giro_ListaItensOffset - 1 GiroDaSorte.GerarListaItens() GiroDaSorte.MoveBarUp(Giro_ItemBar) end Giro_BtnUpListClicked = true return true end if GiroDaSorte.CheckButton(4, x, y) then if #Giro_Itens[Giro_Index] > 5 then if #Giro_Itens[Giro_Index]-Giro_ListaItensOffset >= 5 then Giro_ListaItensOffset = Giro_ListaItensOffset + 1 GiroDaSorte.GerarListaItens() GiroDaSorte.MoveBarDown(Giro_ItemBar) end end Giro_BtnDownListClicked = true return true end if not Giro_Animation then if not Giro_ItemSorteado then if Giro_ItemSorteadoListID ~= 0 then local linha = 289 for i in ipairs(Giro_ListaItens) do if y >= linha+2 and y <= linha+18 and x >= 290 and x <= 405 then Giro_ItemTemp = Giro_ListaItens[i] end linha = linha + 20 end end end end end if Giro_ShowWindowSuccess then if GiroDaSorte.CheckButton(5, x, y) then Giro_ItemSorteadoListID = false Giro_ItemSorteado = false Giro_ItemTemp = false Giro_ShowWindowSuccess = false end end if Giro_ShowWindowNoSpace then if GiroDaSorte.CheckButton(5, x, y) then Giro_ShowWindowNoSpace = false end end if Giro_ShowAlertClose then if GiroDaSorte.CheckButton(5, x, y) then Giro_ShowAlertClose = false GiroDaSorte.FecharJanelaSemPerder() end end if Giro_ShowWindowNoBalance then if GiroDaSorte.CheckButton(5, x, y) then Giro_ShowWindowNoBalance = false Giro_ItemSorteadoListID = false Giro_ItemSorteado = false Giro_ItemTemp = false end end if Giro_ShowWindowConfirm then if GiroDaSorte.CheckButton(5, x, y) then Giro_ShowWindowConfirm = false GiroDaSorte.Girar() end if GiroDaSorte.CheckButton(6, x, y) then Giro_ShowWindowConfirm = false end end end end function GiroDaSorte.SoltarFogos() CreatePacket("GS_Fogos", Giro_Packet) SendPacket("GS_Fogos") ClearPacket("GS_Fogos") end function GiroDaSorte.RetirarItem() CreatePacket("GS_RetirarItem", Giro_Packet) SetBytePacket("GS_RetirarItem", Giro_ItemSorteadoListID) -- (era GetBytePacket: bug do pack) SendPacket("GS_RetirarItem") ClearPacket("GS_RetirarItem") end function GiroDaSorte.Girar() CreatePacket("GS_TentarGirar", Giro_Packet) SetBytePacket("GS_TentarGirar", Giro_Index) SendPacket("GS_TentarGirar") ClearPacket("GS_TentarGirar") end function GiroDaSorte.AbrirJanela(ld) GiroDaSorte.GerarListaItens() GiroDaSorte.GerarBarra(Giro_Itens[Giro_Index], Giro_ItemBar, 5) if ld ~= -1 then Giro_ItemSorteadoListID = ld for i in ipairs(Giro_Itens[Giro_Index]) do if Giro_Itens[Giro_Index][i].ListID == Giro_ItemSorteadoListID then Giro_ItemSorteado = Giro_Itens[Giro_Index][i] end end end UICustomInterface = Giro_WindowID OpenWindow(UIInventory) SetLockInterfaces() end function GiroDaSorte.FecharJanela() Giro_ItemSorteado = false Giro_ItemSorteadoListID = false Giro_ItemTemp = false UICustomInterface = 0 CloseWindow(UIInventory) SetUnlockInterfaces() end function GiroDaSorte.FecharJanelaSemPerder() UICustomInterface = 0 CloseWindow(UIInventory) SetUnlockInterfaces() end function GiroDaSorte.AnimarSorteio() Giro_Animation = true if Giro_ItemSorteadoListID == 0 then Giro_ItemSorteado = 0 else for i in ipairs(Giro_Itens[Giro_Index]) do if Giro_Itens[Giro_Index][i].ListID == Giro_ItemSorteadoListID then Giro_ItemSorteado = Giro_Itens[Giro_Index][i] end end end end function GiroDaSorte.ClientProtocol(Packet, PacketName) if Packet == Giro_Packet then if PacketName == "GS_Vip" then Giro_Vip = GetBytePacket(PacketName, -1) ClearPacket(PacketName) return true end if PacketName == "GS_Abrir" then Giro_Index = GetBytePacket(PacketName, -1) local ld = GetBytePacket(PacketName, -1) ClearPacket(PacketName) GiroDaSorte.AbrirJanela(ld) return true end if PacketName == "GS_Sucesso" then Giro_ItemSorteadoListID = GetBytePacket(PacketName, -1) ClearPacket(PacketName) GiroDaSorte.AnimarSorteio() return true end if PacketName == "GS_ItemOk" then Giro_ShowWindowSuccess = true ClearPacket(PacketName) return true end if PacketName == "GS_NoSpace" then Giro_ShowWindowNoSpace = true ClearPacket(PacketName) return true end if PacketName == "GS_Falha" then Giro_ShowWindowNoBalance = true ClearPacket(PacketName) return true end end end GiroDaSorte.Init() return GiroDaSorte