Explicatia bugului: atunci cand te loghezi , la prima pornire a tombolei totul merge perfect pana cand vrei sa mai pornesti tombola inca o data. In momentul cand apesi pe butonul din inventar iti da ultimul item care ti-a picat la tombola.
Cred ca stiu de la ce este bugul dar sincer nu stiu cum sa il rezolv , acel buton din inventar este recunoscut de catre server prin aceasta functie: when button begin , iar tombola utilizeaza acea functie pentru butonul Start fiind actionat de functia when info or button begin si astfel se creeaza un conflict si tombola crede ca acel buton din inventar face parte din ea.
Sincer nu stiu cu ce sa le inlocuiesc.
Video spune totul.
[bbvideo=560,315]https://www.youtube.com/watch?v=zw9v7Jh ... e=youtu.be[/bbvideo]
Quest:
quest tombola begin
state start begin
function tablica(vnum, pozycja, pozycja2)
local itemy = {
{
{71001, 1},
{71084, 25},
{71085, 25},
{25040, 3},
{27992, 2},
{27993, 2},
{27994, 2},
{27987, 5},
{72002, 1},
{71027, 5},
{71028, 5},
{71029, 5},
{71030, 5},
{71036, 1},
{50008, 15},
{70021, 3},
{71001, 1},
},
{
{71001, 1},
{71084, 25},
{71085, 25},
{25040, 3},
{27992, 2},
{27993, 2},
{27994, 2},
{27987, 5},
{72002, 1},
{71027, 5},
{71028, 5},
{71029, 5},
{71030, 5},
{71036, 1},
{50008, 15},
{70021, 3},
{71001, 1},
}
}
return itemy[vnum][pozycja][pozycja2]
end
when login begin
cmdchat("tombola "..q.getcurrentquestindex())
end
when letter begin
cmdchat("tombola_button "..q.getcurrentquestindex())
end
when info or button begin
local losowo = number(1,2)
local str = " "
for i = 1,16 do
if i == 16 then
str = str..tombola.tablica(losowo, i, 1).."|"..tombola.tablica(losowo, i, 2)
else
str = str..tombola.tablica(losowo, i, 1).."|"..tombola.tablica(losowo, i, 2).."|"
end
end
cmdchat("OnPrepare"..str)
cmdchat("openTombola")
setskin(NOWINDOW)
end
when info or button begin
local Puncte = mysql_query("SELECT puncte from player.player WHERE id="..pc.get_player_id().." LIMIT 1;")[1][1]
local losowo = number(1,2)
if Puncte >= 10 then
local str = " "
for i = 1,16 do
if i == 16 then
str = str..tombola.tablica(losowo, i, 1).."|"..tombola.tablica(losowo, i, 2)
else
str = str..tombola.tablica(losowo, i, 1).."|"..tombola.tablica(losowo, i, 2).."|"
end
end
cmdchat("OnPrepare"..str)
if pc.get_empty_inventory_count() < 3 then
syschat("Nu puteti juca, pentru cã nu aveti suficient spatiu în inventar.")
return
end
cmdchat("get_input_start")
local czynnosc = input(cmdchat("get_input_value"))
cmdchat("get_input_end")
if czynnosc == "tombola|begin" then
pc.setqf("slot", number(1, 16))
cmdchat("OnRun "..number(2,3)*16+pc.getqf("slot").."|5")
elseif czynnosc == "tombola|end" then
local Puncte = mysql_query("SELECT puncte from player.player WHERE id="..pc.get_player_id().." LIMIT 1;")[1][1]
mysql_query("UPDATE player.player SET puncte = puncte-10 WHERE id="..pc.get_player_id().." LIMIT 1;")
cmdchat("Pct "..Puncte)
cmdchat("Pct "..Puncte)
syschat("Felicitãri! Ai primit"..tombola.tablica(losowo, pc.getqf("slot")+1, 2).."x "..item_name(tombola.tablica(losowo, pc.getqf("slot")+1, 1)).." ca o recompensã în Tombola!")
pc.give_item2(tombola.tablica(losowo, pc.getqf("slot")+1, 1), tombola.tablica(losowo, pc.getqf("slot")+1, 2))
cmdchat("Pct "..Puncte)
end
else
say("Ai nevoie de 10 Puncte pentru a utiliza roata norocului.")
cmdchat("Pct "..Puncte)
end
end
end
endimport app
import constInfo
import ui
import uiToolTip
import item
import locale
import player
import grp
import time
import event
class TombolaWindow(ui.BoardWithTitleBar):
def __init__(self):
ui.BoardWithTitleBar.__init__(self)
self.__BuildWindow()
def __del__(self):
ui.BoardWithTitleBar.__del__(self)
def __BuildWindow(self):
self.xOpen = 0
self.yOpen = 0
self.speedDown = 5
self.timeDiff = 0.1
self.tooltipItem = None
self.animate = FALSE
self.blink = FALSE
self.blinkTimes = 6
self.blinkLast = 0
self.position = 1
self.toPosition = 16
self.lastClock = 0
self.SetSize(341, 364)
self.AddFlag("float")
self.AddFlag("movable")
self.SetTitleName("Ruleta Destinului")
image = ui.ImageBox()
image.SetParent(self)
image.LoadImage("locale/es/ui/tombola/background.tga")
image.SetPosition(6, 29)
image.Show()
self.background = image
select = ui.ImageBox()
select.SetParent(self.background)
select.SetPosition(0, 0)
select.LoadImage("locale/es/ui/tombola/1.tga")
select.Hide()
self.select = select
button = ui.Button()
button.SetParent(self.background)
button.SetPosition(125, 124)
button.SetUpVisual("locale/es/ui/tombola/button.tga")
button.SetOverVisual("locale/es/ui/tombola/button_hover.tga")
button.SetDownVisual("locale/es/ui/tombola/button_down.tga")
button.SetEvent(ui.__mem_func__(self.OnButtonClick))
button.Show()
self.run = button
self.slots = [
self.__CreateSlot(1, 161 - 5, 53 - 4),
self.__CreateSlot(2, 207 - 5, 63 - 4),
self.__CreateSlot(3, 248 - 5, 93 - 4),
self.__CreateSlot(4, 277 - 5, 135 - 4),
self.__CreateSlot(5, 290 - 5, 182 - 4),
self.__CreateSlot(6, 277 - 5, 228 - 4),
self.__CreateSlot(7, 248 - 5, 271 - 4),
self.__CreateSlot(8, 207 - 5, 298 - 4),
self.__CreateSlot(9, 160 - 5, 307 - 4),
self.__CreateSlot(10, 114 - 5, 296 - 4),
self.__CreateSlot(11, 72 - 5, 269 - 4),
self.__CreateSlot(12, 44 - 5, 229 - 4),
self.__CreateSlot(13, 30 - 5, 183 - 4),
self.__CreateSlot(14, 41 - 5, 133 - 4),
self.__CreateSlot(15, 70 - 5, 92 - 4),
self.__CreateSlot(16, 112 - 5, 63 - 4)
]
self.items = {}
def __CreateSlot(self, number, x, y):
grid = ui.GridSlotWindow()
grid.SetParent(self)
grid.SetPosition(x, y)
grid.ArrangeSlot(number, 1, 1, 32, 32, 0, 0)
grid.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
grid.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
grid.RefreshSlot()
grid.Show()
return grid
def OverInItem(self, slotIndex):
if slotIndex < 1 or slotIndex > 16:
return
self.tooltipItem = uiToolTip.ItemToolTip()
self.tooltipItem.AddItemData(self.items[slotIndex - 1], 0, 0)
self.tooltipItem.Show()
def OverOutItem(self):
if self.tooltipItem:
self.tooltipItem.HideToolTip()
def OnButtonClick(self):
self.run.Disable()
self.run.Down()
constInfo.VID = "tombola|begin"
event.QuestButtonClick(constInfo.TOMBOLA)
def OnPrepare(self, items):
items = items.split("|")
j = 0
for i in range(0, 32, 2):
self.slots[j].SetItemSlot(j + 1, int(items), int(items[i + 1]))
self.items[j] = int(items)
j += 1
def OnRun(self, data):
data = data.split("|")
self.toPosition = int(data[0])
self.speedDown = int(data[1])
self.blinkTimes = 6
self.blinkLast = 0
self.position = 1
self.animate = TRUE
self.blink = FALSE
self.timeDiff = 0.1
self.lastClock = app.GetTime()
def OnUpdate(self):
if self.animate == TRUE:
if (app.GetTime() - self.lastClock) >= self.timeDiff:
self.lastClock = app.GetTime()
self.toPosition -= 1
if self.toPosition <= self.speedDown:
self.timeDiff += 0.1
self.position += 1
if self.position == 17:
self.position = 1
if not self.select.IsShow():
self.select.Show()
self.select.LoadImage("locale/es/ui/tombola/" + str(self.position) + ".tga")
if self.toPosition == 0:
self.animate = FALSE
self.blink = TRUE
self.run.Enable()
self.run.SetUp()
constInfo.VID = "tombola|end"
event.QuestButtonClick(constInfo.TOMBOLA)
if self.blink == TRUE and (app.GetTime() - self.blinkLast) >= 0.3:
if self.blinkTimes > 0:
if self.blinkTimes % 2:
self.select.Hide()
else:
self.select.Show()
self.blinkTimes -= 1
else:
self.blink = FALSE
self.blinkTimes = 6
self.blinkLast = 0
self.select.Hide()
self.select.LoadImage("locale/es/ui/tombola/1.tga")
self.blinkLast = app.GetTime()
(x, y, z) = player.GetMainCharacterPosition()
def Open(self):
if not self.IsShow():
self.Show()
(self.xOpen, self.yOpen, z) = player.GetMainCharacterPosition()
def Close(self):
if self.IsShow():
self.Hide()
def OnPressEscapeKey(self):
self.Close()
return TRUEGame:
uiinventory: inventorywindow:



de