|
You last visited: Today at 12:45
Advertisement
[Python]How i can modify uitombola.py to give only one item from a position.
Discussion on [Python]How i can modify uitombola.py to give only one item from a position. within the Metin2 Private Server forum part of the Metin2 category.
07/24/2017, 22:17
|
#1
|
elite*gold: 0
Join Date: May 2012
Posts: 12
Received Thanks: 0
|
[Python]How i can modify uitombola.py to give only one item from a position.
Hello , how i can make tombola script to give only one item ? the item from the position 7.
I want to make this to troll my players, in my server you can use tombola every 12 hours but i want to troll them just for a week  .
PS: Peoples will tell me to modify items in quest directly but if you modify directly from quest peoples will see same item in all slots..., i want them to see all different items but script to give only one of them.
There is the python script of tombola for those who know tombola from thoria.
Code:
import 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")
self.SetCloseEvent(ui.__mem_func__(self.OnClose))
image = ui.ImageBox()
image.SetParent(self)
image.LoadImage("locale/ro/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/ro/ui/tombola/1.tga")
select.Hide()
self.select = select
button = ui.Button()
button.SetParent(self.background)
button.SetPosition(125, 124)
button.SetUpVisual("locale/ro/ui/tombola/button.tga")
button.SetOverVisual("locale/ro/ui/tombola/button_hover.tga")
button.SetDownVisual("locale/ro/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[i]), int(items[i + 1]))
self.items[j] = int(items[i])
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/ro/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/ro/ui/tombola/1.tga")
self.blinkLast = app.GetTime()
(x, y, z) = player.GetMainCharacterPosition()
if abs(x - self.xOpen) > 1000 or abs(y - self.yOpen) > 1000:
self.Close()
def Open(self):
if not self.IsShow():
self.Show()
(self.xOpen, self.yOpen, z) = player.GetMainCharacterPosition()
else:
self.Close()
def Close(self):
if self.IsShow():
self.Hide()
def OnClose(self):
self.Close()
def OnPressEscapeKey(self):
self.Close()
return TRUE
|
|
|
07/25/2017, 15:42
|
#2
|
elite*gold: 0
Join Date: Dec 2014
Posts: 1,018
Received Thanks: 499
|
Quote:
Originally Posted by alberto2011
Hello , how i can make tombola script to give only one item ? the item from the position 7.
I want to make this to troll my players, in my server you can use tombola every 12 hours but i want to troll them just for a week  .
PS: Peoples will tell me to modify items in quest directly but if you modify directly from quest peoples will see same item in all slots..., i want them to see all different items but script to give only one of them.
There is the python script of tombola for those who know tombola from thoria.
Code:
import 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")
self.SetCloseEvent(ui.__mem_func__(self.OnClose))
image = ui.ImageBox()
image.SetParent(self)
image.LoadImage("locale/ro/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/ro/ui/tombola/1.tga")
select.Hide()
self.select = select
button = ui.Button()
button.SetParent(self.background)
button.SetPosition(125, 124)
button.SetUpVisual("locale/ro/ui/tombola/button.tga")
button.SetOverVisual("locale/ro/ui/tombola/button_hover.tga")
button.SetDownVisual("locale/ro/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[i]), int(items[i + 1]))
self.items[j] = int(items[i])
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/ro/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/ro/ui/tombola/1.tga")
self.blinkLast = app.GetTime()
(x, y, z) = player.GetMainCharacterPosition()
if abs(x - self.xOpen) > 1000 or abs(y - self.yOpen) > 1000:
self.Close()
def Open(self):
if not self.IsShow():
self.Show()
(self.xOpen, self.yOpen, z) = player.GetMainCharacterPosition()
else:
self.Close()
def Close(self):
if self.IsShow():
self.Hide()
def OnClose(self):
self.Close()
def OnPressEscapeKey(self):
self.Close()
return TRUE
|
first of all, this isnt a system by thoria more likely it is being used without credits, some of our german developers made it.
i do not understand what you want, can you explain it better?
|
|
|
07/25/2017, 18:29
|
#3
|
elite*gold: 0
Join Date: May 2012
Posts: 12
Received Thanks: 0
|
Quote:
Originally Posted by BizepsSupportAccount
first of all, this isnt a system by thoria more likely it is being used without credits, some of our german developers made it.
i do not understand what you want, can you explain it better?
|
So i will explain better , this python script is for tombola ingame , now it works normaly , i want to modify this script to give the same item from position 8 every time you press Start button.
how tombola looks:
i want every time you press start button to give you the item from position 8 without modifying the quest because if you modify the quest they will see all items are the same , i want all items to be different but tombola to give you only the item from position 8.
Ik i have to modify the python script i posted above but i don't know how , i think is something from here:
Code:
def OnPrepare(self, items):
items = items.split("|")
j = 0
for i in range(0, 32, 2):
self.slots[j].SetItemSlot(j + 1, int(items[i]), int(items[i + 1]))
self.items[j] = int(items[i])
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/ro/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/ro/ui/tombola/1.tga")
self.blinkLast = app.GetTime()
(x, y, z) = player.GetMainCharacterPosition()
if abs(x - self.xOpen) > 1000 or abs(y - self.yOpen) > 1000:
self.Close()
Is is possible or not ?
|
|
|
 |
Similar Threads
|
can somebody help [python position and channel ports]
03/18/2015 - Metin2 Private Server - 2 Replies
hello epvp
the first problem :
yesterday i changed my channel ports and db port
the server is working fine but i get a stupid problem
when i opening a client in interface the channels is not change from "..." to " normal" i can login to game and its work very well but her condition dont change
like this:
http://www.m5zn.com/newuploads/2015/03/17/png//36 6e8e14f5eed1a.png
|
can somebody help [python position and channel ports]
03/17/2015 - Metin2 Private Server - 0 Replies
hello epvp
the first problem :
yesterday i changed my channel ports and db port
the server is working fine but i get a stupid problem
when i opening a client in interface the channels is not change from "..." to " normal" i can login to game and its work very well but her condition dont change
like this:
http://www.m5zn.com/newuploads/2015/03/17/png//36 6e8e14f5eed1a.png
|
[ASK]How to modify camera position?
10/05/2013 - Elsword - 4 Replies
As stated from the title. I'm concern about which lua i have to edit for the camera angles when + & - button is presssed..
|
[Request]Getting item info of an item on a position
06/02/2009 - CO2 Private Server - 0 Replies
I can`t figure this out. I`m using CoEmuV2, btw. I thought that it could be done with SQL but... I suck at SQL ^.^. Sooo... could anyone help me out?
I`m trying to get the item information (level, +, quality, etc.) on an Equipement position, like 4 (Right Hand).
|
All times are GMT +1. The time now is 12:45.
|
|