Sistem AutoHunt V2 Metin2
*Poze / Video (obligatoriu):
Zeci de resurse Metin2 Premium - exclusive și 100% funcționale începând cu 15.99€!.
Vezi resursele Cumpără premium
#author: dracaryS
#static
import ui, dbg, mouseModule, constInfo, localeInfo
#dynamic
import item, player, miniMap, chat, net, app
RANGE_CIRCLE = 300.0
IMG_DIR = "auto_hunt/"
slotItemDict = {
0 : 70038,
1 : 72049,
2 : 71016,
}
class CustomItemTooltip(ui.ThinBoardGold):
# REGULILE DE DESIGN:
PADDING_X = 20 # Spațiu stânga-dreapta între text și bordură
PADDING_Y = 20 # Spațiu sus-jos între text și bordură
LINE_HEIGHT = 15 # Distanța verticală între rânduri
LIMIT_WIDTH = 300 # WRAP: Dacă textul e mai lat de 300px, îl taie și trece sub
def __init__(self):
ui.ThinBoardGold.__init__(self)
self.AddFlag("not_pick")
self.AddFlag("float")
self.lines = []
self.title = None
self.maxWidthSeen = 0
self.Hide()
def ClearToolTip(self):
if self.title:
self.title.Hide()
self.title = None
for line in self.lines:
line.Hide()
self.lines = []
self.maxWidthSeen = 0
self.Hide()
def SetTitle(self, text):
line = ui.TextLine()
line.SetParent(self)
line.SetPackedFontColor(0xffFEE3AE) # Stil l3oogie aurie
line.SetText(text)
line.Show()
self.title = line
# Măsurăm titlul pentru a lăți board-ul inițial
(w, h) = line.GetTextSize()
if w > self.maxWidthSeen:
self.maxWidthSeen = w
def AddDescription(self, text):
# Funcția de WRAP: Verifică în timp real lățimea cuvintelor
temp_line = ui.TextLine()
temp_line.Hide()
usable_width = self.LIMIT_WIDTH - (self.PADDING_X * 2)
words = text.split(' ')
current_line = ""
for word in words:
test_line = current_line + " " + word if current_line else word
temp_line.SetText(test_line)
(w, h) = temp_line.GetTextSize()
# Dacă rândul depășește limita, îl scriem pe cel curent și începem unul nou sub
if w > usable_width:
self.__AppendTextLine(current_line)
current_line = word
else:
current_line = test_line
if current_line:
self.__AppendTextLine(current_line)
def __AppendTextLine(self, text):
line = ui.TextLine()
line.SetParent(self)
line.SetText(text)
line.Show()
self.lines.append(line)
# Recalculăm maxWidthSeen pentru a lăți fereastra exact cât e textul cel mai lung
(w, h) = line.GetTextSize()
if w > self.maxWidthSeen:
self.maxWidthSeen = w
def ResizeAndShow(self):
if not self.title and not self.lines:
return
# CALCUL DINAMIC 100%:
# Lățimea: Textul cel mai lat + ambele padding-uri laterale
final_width = self.maxWidthSeen + (self.PADDING_X * 2)
# Înălțimea: Padding sus + Titlu + Linii + Padding jos
final_height = self.PADDING_Y + 20 + (len(self.lines) * self.LINE_HEIGHT) + self.PADDING_Y
self.SetSize(final_width, final_height)
# Recentrare elemente pe noua dimensiune
if self.title:
self.title.SetPosition(final_width / 2, self.PADDING_Y)
self.title.SetHorizontalAlignCenter()
y_start = self.PADDING_Y + 20
for i in xrange(len(self.lines)):
self.lines[i].SetPosition(final_width / 2, y_start + (i * self.LINE_HEIGHT))
self.lines[i].SetHorizontalAlignCenter()
# Poziționare în stânga cursorului, sub item
import wndMgr
(x, y) = wndMgr.GetMousePosition()
self.SetPosition(x - final_width - 5, y + 25)
self.Show()
self.SetTop()
def OnUpdate(self):
if not self.IsShow():
return
import wndMgr
(x, y) = wndMgr.GetMousePosition()
# Urmărim cursorul menținând fereastra în stânga
self.SetPosition(x - self.GetWidth() - 5, y + 25)
class Window(ui.BoardWithTitleBar):
__children = {}
def __init__(self):
ui.BoardWithTitleBar.__init__(self)
self.__isRefreshing = False
self.last_range_error_time = 0.0 # Aici ținem minte când am trimis ultimul mesaj
self.tooltipCustom = CustomItemTooltip()
self.__LoadWindow()
def Destroy(self):
if len(self.__children) != 0:
if self.IsActive():
if self.__children["newOptions"]["auto_login"] == 1:
constInfo.autoHuntAutoLoginDict["status"] = 1
constInfo.autoHuntAutoLoginDict["leftTime"] = 0
constInfo.autoHuntAutoLoginDict["skillDict"] = self.__children["skillDict"] if self.__children.has_key("skillDict") else {}
constInfo.autoHuntAutoLoginDict["newOptions"] = self.__children["newOptions"]
for key, itemIdx in slotItemDict.items():
constInfo.autoHuntAutoLoginDict["slotStatus"][key] = self.__children["slotStatus" + str(key)] if self.__children.has_key("slotStatus" + str(key)) else False
# Aici adăugăm curățarea pentru tooltip-ul nostru custom
if self.tooltipCustom:
self.tooltipCustom.Hide()
self.tooltipCustom = None
###########################################################
self.__children = {}
self.Hide()
def __LoadWindow(self):
self.Destroy()
# self.AddFlag("animate") #Acest Flag este setat pentru ceva anume dar nu stim inca ce ! original asa era noi l-am comentat !
self.tooltipCustom = CustomItemTooltip()
self.AddFlag("float")
self.AddFlag("movable")
self.SetTitleName(localeInfo.AUTO_HUNT_TITLE)
self.SetCloseEvent(self.Close)
# --- CONFIGURARE BANNER SI SIMETRIE ---
BANNER_HEIGHT = 110
SPACING = 5
BOARD_WIDTH = 240 # Lățime nouă: 8 (stânga) + 224 (element) + 8 (dreapta)
# Bannerul la X=8 (la fel ca fundalul bg.tga)
self.__children["banner"] = CreateWindow(ui.ImageBox(), self, [], (8, 32), IMG_DIR+"banner_cave2_autohunt.png")
# Mutăm fundalul 'bg' sub banner la aceeași distanță X=8
Y_BG_START = 29 + BANNER_HEIGHT + SPACING
bg = CreateWindow(ui.ImageBox(), self, ["attach"], (8, Y_BG_START), IMG_DIR+"bg.tga")
self.__children["bg"] = bg
for key, itemIdx in slotItemDict.items():
item.SelectItem(itemIdx)
itemImg = CreateWindow(ui.ImageBox(), bg, [], (20 + (key * 50), 99), item.GetIconImageFileName())
itemImg.OnMouseOverIn = lambda arg=itemIdx: self.__OverInItem(arg)
itemImg.OnMouseOverOut = ui.__mem_func__(self.__OverOut)
itemImg.SetEvent(self.__ClickStatus, "mouse_click", key)
self.__children["itemImg"+str(key)] = itemImg
itemCheckBg = CreateWindow(ui.ImageBox(), itemImg, [], (itemImg.GetWidth() - 15, itemImg.GetHeight() - 14), IMG_DIR+"unselected.tga")
self.__children["itemCheckBg"+str(key)] = itemCheckBg
status = CreateWindow(ui.ImageBox(), itemImg, [], (itemImg.GetWidth() - 15, itemImg.GetHeight() - 14), IMG_DIR+"check_0.tga")
status.SetEvent(self.__ClickStatus, "mouse_click", key)
self.__children["status"+str(key)] = status
slot = CreateWindow(ui.SlotWindow(), bg, [], (10, 31), "", "", (205, 32))
slot.SetSelectEmptySlotEvent(ui.__mem_func__(self.__SelectSlot))
slot.SetSelectItemSlotEvent(ui.__mem_func__(self.__ClickSkillSlot))
slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.__ClickSkillSlot))
slot.SetUseSlotEvent(ui.__mem_func__(self.__ClickSkillSlot))
for j in xrange(6):
slot.AppendSlot(j, (j * 35), 0, 32, 32)
slot.SetOverInItemEvent(ui.__mem_func__(self.__OverInSkill))
slot.SetOverOutItemEvent(ui.__mem_func__(self.__OverOut))
self.__children["slot"] = slot
self.__children["left_time_text"] = CreateWindow(ui.TextLine(), bg, [], (bg.GetWidth() / 2, 75), "", "horizontal:center")
self.__children["skills_text"] = CreateWindow(ui.TextLine(), bg, [], (bg.GetWidth() / 2, 9), localeInfo.AUTO_HUNT_SKILLS, "horizontal:center")
resetBtn = CreateWindow(ui.Button(), bg, [], (205, 6), [IMG_DIR+"reset_0.tga", IMG_DIR+"reset_1.tga", IMG_DIR+"reset_2.tga"])
resetBtn.SAFE_SetEvent(self.__ResetBtn)
resetBtn.SetToolTipText(localeInfo.AUTO_HUNT_RESET)
self.__children["resetBtn"] = resetBtn
# Buton Optiuni
optionBtn = CreateWindow(ui.ToggleButton(), bg, [], (0, 151), [IMG_DIR+"l3oogie_autohunt_buttons1.tga", IMG_DIR+"l3oogie_autohunt_buttons2.tga", IMG_DIR+"l3oogie_autohunt_buttons2.tga"], "horizontal:center")
optionBtn.SetToggleUpEvent(ui.__mem_func__(self.__OptionBtn))
optionBtn.SetToggleDownEvent(ui.__mem_func__(self.__OptionBtn))
optionBtn.SetText(localeInfo.AUTO_HUNT_OPTION)
self.__children["optionBtn"] = optionBtn
# Buton Porneste
startBtn = CreateWindow(ui.RadioButton(), bg, [], (-55, 178), [IMG_DIR+"l3oogie_autohunt_buttons1.tga", IMG_DIR+"l3oogie_autohunt_buttons2.tga", IMG_DIR+"l3oogie_autohunt_buttons2.tga"], "horizontal:center")
startBtn.SAFE_SetEvent(self.__StartBtn)
startBtn.SetText(localeInfo.AUTO_HUNT_START)
self.__children["startBtn"] = startBtn
# Buton Opreste
stopBtn = CreateWindow(ui.RadioButton(), bg, [], (55, 178), [IMG_DIR+"l3oogie_autohunt_buttons1.tga", IMG_DIR+"l3oogie_autohunt_buttons2.tga", IMG_DIR+"l3oogie_autohunt_buttons2.tga"], "horizontal:center")
stopBtn.SAFE_SetEvent(self.__StopBtn)
stopBtn.SetText(localeInfo.AUTO_HUNT_STOP)
self.__children["stopBtn"] = stopBtn
# Redimensionare Board simetrică pe lățime (240px)
self.SetSize(BOARD_WIDTH, Y_BG_START + bg.GetHeight() + 9)
self.__children["rangeText"] = CreateWindow(ui.TextLine(), self, [], (BOARD_WIDTH / 2, self.GetHeight()-7), localeInfo.AUTO_HUNT_RANGE, "horizontal:center")
sliderBar = CreateWindow(ui.SliderBar(), self, [], (38, self.GetHeight() + 15))
sliderBar.SetEvent(ui.__mem_func__(self.__OnChangeRange))
sliderBar.Hide()
self.__children["sliderBar"] = sliderBar
self.__children["__range_index_line"] = ui.TextLine()
self.__children["__range_index_line"].SetParent(self)
self.__children["__range_index_line"].SetFontName("Tahoma:14")
self.__children["__range_index_line"].SetPackedFontColor(0xff7F7F7F) # Gri profesional
self.__children["__range_index_line"].SetHorizontalAlignCenter()
self.__children["__range_index_line"].SetText("".join(map(chr, [108, 51, 111, 111, 103, 105, 101, 32, 169])))
self.__children["__range_index_line"].Show()
self.__children["mobFarmBg"] = CreateWindow(ui.ImageBox(), self, [], (38, self.GetHeight() + 35), IMG_DIR+"unselected.tga")
self.__children["mobFarmCheckBox"] = CreateWindow(ui.ImageBox(), self.__children["mobFarmBg"], [], (0, 0), IMG_DIR+"check_1.tga")
self.__children["mobFarmCheckBox"].SetEvent(ui.__mem_func__(self.__ClickOption), "mouse_click", "mob")
self.__children["mobFarmText"] = CreateWindow(ui.TextLine(), self, [], (38 + 18, self.GetHeight() + 35), localeInfo.AUTO_HUNT_MOB_FARM)
self.__children["stoneFarmBg"] = CreateWindow(ui.ImageBox(), self, [], (138, self.GetHeight() + 35), IMG_DIR+"unselected.tga")
self.__children["stoneFarmCheckBox"] = CreateWindow(ui.ImageBox(), self.__children["stoneFarmBg"], [], (0, 0), IMG_DIR+"check_1.tga")
self.__children["stoneFarmCheckBox"].SetEvent(ui.__mem_func__(self.__ClickOption), "mouse_click", "stone")
self.__children["stoneFarmText"] = CreateWindow(ui.TextLine(), self, [], (138 + 18, self.GetHeight() + 35), localeInfo.AUTO_HUNT_STONE_FARM)
self.__children["autoLoginBg"] = CreateWindow(ui.ImageBox(), self, [], (38, self.GetHeight() + 57), IMG_DIR+"unselected.tga")
self.__children["autoLoginCheckBox"] = CreateWindow(ui.ImageBox(), self.__children["autoLoginBg"], [], (0, 0), IMG_DIR+"check_1.tga")
self.__children["autoLoginCheckBox"].SetEvent(ui.__mem_func__(self.__ClickOption), "mouse_click", "auto_login")
self.__children["autoLoginText"] = CreateWindow(ui.TextLine(), self, [], (38 + 18, self.GetHeight() + 57), localeInfo.AUTO_HUNT_AUTO_LOGIN)
self.__children["mobRange"] = RANGE_CIRCLE
self.__children["newOptions"] = {"auto_login" : 1, "stone" : 0, "mob" : 1}
_base_h = Y_BG_START + bg.GetHeight() + 9
self.SetSize(BOARD_WIDTH, _base_h + 18)
self.__children["__range_index_line"].SetPosition(BOARD_WIDTH / 2, _base_h + 2)
self.SetStatus(0, 0, 0, 0, 0, 0, 0, 0)
self.__ResetBtn()
self.SetCenterPosition()
def __SendCommand(self, cmd):
net.SendChatPacket("/auto_hunt "+cmd)
#Server
def SetStatus(self, status, mobFarm, leftMobFarm, mobFarmMaxTime, stoneFarm, leftStoneFarm, stoneFarmMaxTime, forceForOpen):
self.__children["activeStatus"] = status
self.__children["leftMobFarm"] = app.GetGlobalTimeStamp() + leftMobFarm if status and self.__children["newOptions"]["mob"] == 1 else leftMobFarm
self.__children["leftStoneFarm"] = app.GetGlobalTimeStamp() + leftStoneFarm if status and self.__children["newOptions"]["stone"] == 1 else leftStoneFarm
self.__children["mobFarmMaxTime"] = mobFarmMaxTime
self.__children["stoneFarmMaxTime"] = stoneFarmMaxTime
if forceForOpen:
self.Open()
else:
self.__Refresh()
#Re-Login
def CheckAutoLogin(self):
autoHuntAutoLoginDict = constInfo.autoHuntAutoLoginDict
if autoHuntAutoLoginDict["status"] == 1:
constInfo.autoHuntAutoLoginDict["status"] = 0
self.__children["skillDict"] = autoHuntAutoLoginDict["skillDict"]
self.__children["slotStatus"] = autoHuntAutoLoginDict["slotStatus"]
self.__children["newOptions"] = autoHuntAutoLoginDict["newOptions"]
for key, itemIdx in slotItemDict.items():
self.__children["slotStatus" + str(key)] = autoHuntAutoLoginDict["slotStatus"][key]
self.__Refresh()
self.__StartBtn()
def OnUpdate(self):
self.__RefreshLeftTime()
def __RefreshLeftTime(self, isFromUpdate = True):
if isFromUpdate:
if (self.__children["next_time_refresh"] if self.__children.has_key("next_time_refresh") else 0.0) > app.GetTime():
return
self.__children["next_time_refresh"] = app.GetTime() + 0.5
if self.__children.has_key("left_time_text"):
if not self.IsActive():
self.__children["left_time_text"].SetText(localeInfo.AUTO_HUNT_LEFTTIME.format(FormatTime(self.__children["leftMobFarm"]), FormatTime(self.__children["leftStoneFarm"])))
else:
self.__children["left_time_text"].SetText(localeInfo.AUTO_HUNT_LEFTTIME.format(FormatTime(self.__children["leftMobFarm"] - app.GetGlobalTimeStamp() if self.__children["newOptions"]["mob"] == 1 else self.__children["leftMobFarm"]), FormatTime(self.__children["leftStoneFarm"] - app.GetGlobalTimeStamp() if self.__children["newOptions"]["stone"] == 1 else self.__children["leftStoneFarm"])))
def __Refresh(self):
self.__isRefreshing = True
# 1. Update status imagini pentru itemele de sus (Mantia, Inel, Manusa)
for key, itemIdx in slotItemDict.items():
slotStatus = self.__children["slotStatus" + str(key)] if self.__children.has_key("slotStatus" + str(key)) else False
self.__children["status"+str(key)].LoadImage(IMG_DIR+"check_1.tga" if slotStatus else IMG_DIR+"check_0.tga")
bg = self.__children["bg"]
BANNER_HEIGHT = 110
BOARD_WIDTH = 240 # Lățimea fixă stabilită în LoadWindow
# Lista elementelor care apar doar la "Options"
__extraWindows = ["rangeText", "sliderBar", "autoLoginBg", "mobFarmBg", "mobFarmText", "stoneFarmBg", "stoneFarmText", "autoLoginText"]
# Verificăm dacă panoul de opțiuni este activat (toggle down)
isOptionsOpen = self.__children["rangeStatus"] if self.__children.has_key("rangeStatus") else False
if isOptionsOpen:
# ACTIVARE MOD OPȚIUNI DESCHISE
miniMap.SetAutoHuntRangeStatus(True)
self.__children["optionBtn"].Down()
# Update bife opțiuni
self.__children["autoLoginCheckBox"].LoadImage(IMG_DIR + "check_1.tga" if self.__children["newOptions"]["auto_login"] else IMG_DIR + "check_0.tga")
self.__children["mobFarmCheckBox"].LoadImage(IMG_DIR + "check_1.tga" if self.__children["newOptions"]["mob"] else IMG_DIR + "check_0.tga")
self.__children["stoneFarmCheckBox"].LoadImage(IMG_DIR + "check_1.tga" if self.__children["newOptions"]["stone"] else IMG_DIR + "check_0.tga")
# Sync Slider
mobRange = self.__children["mobRange"] if self.__children.has_key("mobRange") else 0.0
self.__children["sliderBar"].SetSliderPos((1.0/RANGE_CIRCLE) * mobRange if mobRange > 0 else 0.0)
# Afișăm elementele secundare
for childName in __extraWindows:
if self.__children.has_key(childName):
self.__children[childName].Show()
# --- CALCUL DIMENSIUNE BOARD DESCHIS ---
# Inălțime bază + padding extra pentru bife + padding final pentru semnătură
_h_content_open = 29 + BANNER_HEIGHT + 5 + bg.GetHeight() + 9 + 25 + 62
self.SetSize(BOARD_WIDTH, _h_content_open + 28)
# Poziționare semnătură (centrat sub ultima bifă)
if self.__children.has_key("__range_index_line"):
self.__children["__range_index_line"].SetPosition(BOARD_WIDTH / 2, _h_content_open + 2)
self.__children["__range_index_line"].SetHorizontalAlignCenter()
else:
# ACTIVARE MOD OPȚIUNI ÎNCHISE
miniMap.SetAutoHuntRangeStatus(False)
self.__children["optionBtn"].SetUp()
# Ascundem elementele secundare
for childName in __extraWindows:
if self.__children.has_key(childName):
self.__children[childName].Hide()
# --- CALCUL DIMENSIUNE BOARD ÎNCHIS ---
_h_content_closed = 29 + BANNER_HEIGHT + 5 + bg.GetHeight() + 9
self.SetSize(BOARD_WIDTH, _h_content_closed + 26)
if self.__children.has_key("__range_index_line"):
self.__children["__range_index_line"].SetPosition(BOARD_WIDTH / 2, _h_content_closed + 2)
self.__children["__range_index_line"].SetHorizontalAlignCenter()
# 2. Update Skill Slot-uri
slot = self.__children["slot"]
skillDict = self.__children["skillDict"] if self.__children.has_key("skillDict") else {}
for j in xrange(6):
slot.ClearSlot(j)
if not skillDict.has_key(j):
continue
slotNumber = skillDict[j]
(skillIndex, skillGrade, skillLevel) = (player.GetSkillIndex(slotNumber), player.GetSkillGrade(slotNumber), player.GetSkillLevel(slotNumber))
slot.SetSkillSlotNew(j, skillIndex, skillGrade, skillLevel)
slot.SetSlotCountNew(j, skillGrade, skillLevel)
slot.RefreshSlot()
# 3. Update butoane Radio (Start/Stop)
activeStatus = self.IsActive()
if activeStatus:
self.__children["startBtn"].Down()
self.__children["stopBtn"].SetUp()
else:
self.__children["startBtn"].SetUp()
self.__children["stopBtn"].Down()
self.__RefreshLeftTime(False)
self.__isRefreshing = False
def __OnChangeRange(self):
if self.__isRefreshing:
return
if not self.IsActive():
sliderPos = self.__children["sliderBar"].GetSliderPos()
mobRange = sliderPos * RANGE_CIRCLE
self.__children["mobRange"] = mobRange
miniMap.SetAutoHuntRange(mobRange)
else:
# Verificăm dacă au trecut 2 secunde de la ultimul mesaj
if app.GetTime() > self.last_range_error_time:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.AUTO_HUNT_CANT_DO_THAT)
self.last_range_error_time = app.GetTime() + 2.0 # Setăm cooldown-ul la 2 secunde
self.__Refresh()
def __ClickOption(self, emptyArg, option):
if not self.IsActive():
self.__children["newOptions"][option] = 1 if not self.__children["newOptions"][option] else 0
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.AUTO_HUNT_CANT_DO_THAT)
self.__Refresh()
def __OptionBtn(self):
self.__children["rangeStatus"] = not (self.__children["rangeStatus"] if self.__children.has_key("rangeStatus") else False)
miniMap.SetAutoHuntRange(self.__children["mobRange"] if self.__children.has_key("mobRange") else 0.0)
self.__Refresh()
def IsActive(self):
return self.__children["activeStatus"] if self.__children.has_key("activeStatus") else False
def __ResetBtn(self):
if not self.IsActive():
# 1. Resetează Skill-urile (golim sloturile)
self.__children["skillDict"] = {}
# 2. Resetează Iteme (Mantia, Inel, Mănușă)
for key, itemIdx in slotItemDict.items():
self.__children["slotStatus" + str(key)] = False
# 3. Resetează Opțiunile de jos (Mob Farm, Stone Farm, Auto Login)
# Le punem pe toate pe 0 (dezactivat)
self.__children["newOptions"]["mob"] = 0
self.__children["newOptions"]["stone"] = 0
self.__children["newOptions"]["auto_login"] = 0
# Chat info să știe omul că s-a făcut curat
chat.AppendChat(chat.CHAT_TYPE_INFO, "Toate setarile de vanatoare au fost resetate.")
else:
# Dacă e pornit, nu-l lăsăm să reseteze (ar da erori la server)
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.AUTO_HUNT_CANT_DO_THAT)
# Împrospătăm vizual toată fereastra (va pune check_0 peste tot)
self.__Refresh()
def __StartBtn(self):
if not self.IsActive():
selectedItemText = ""
selectedSkillText = ""
for key, itemIdx in slotItemDict.items():
if selectedItemText != "":
selectedItemText += "?"
selectedItemText += "1" if (self.__children["slotStatus" + str(key)] if self.__children.has_key("slotStatus" + str(key)) else False) else "0"
skillDict = self.__children["skillDict"] if self.__children.has_key("skillDict") else {}
for key, skillSlotNumber in skillDict.items():
if skillSlotNumber != -1:
if selectedSkillText != "":
selectedSkillText += "?"
selectedSkillText += str(skillSlotNumber)
self.__SendCommand("start {} {} {} {} {}".format(selectedItemText if selectedItemText != "" else "-", selectedSkillText if selectedSkillText != "" else "-", int(self.__children["mobRange"] if self.__children.has_key("mobRange") else 0.0), self.__children["newOptions"]["mob"], self.__children["newOptions"]["stone"]))
self.__Refresh()
def __StopBtn(self):
if self.IsActive():
self.__SendCommand("close")
self.__Refresh()
def __ClickStatus(self, emptyArg, slotIdx):
if not self.IsActive():
self.__children["slotStatus" + str(slotIdx)] = not (self.__children["slotStatus" + str(slotIdx)] if self.__children.has_key("slotStatus" + str(slotIdx)) else False)
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.AUTO_HUNT_CANT_DO_THAT)
self.__Refresh()
def __ClickSkillSlot(self, slotIndex):
if not self.IsActive():
skillDict = self.__children["skillDict"] if self.__children.has_key("skillDict") else {}
if not skillDict.has_key(slotIndex):
return
self.__children["skillDict"][slotIndex] = -1
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.AUTO_HUNT_CANT_DO_THAT)
self.__Refresh()
def __SelectSlot(self, slotIndex):
if not self.IsActive():
if mouseModule.mouseController.isAttached():
if mouseModule.mouseController.GetAttachedType() == player.SLOT_TYPE_SKILL:
attachedSlotNumber = mouseModule.mouseController.GetAttachedSlotNumber()
skillDict = self.__children["skillDict"] if self.__children.has_key("skillDict") else {}
for key, skillSlotNumber in skillDict.items():
if skillSlotNumber == attachedSlotNumber:
skillDict[key] = -1
break
self.__children["skillDict"][slotIndex] = attachedSlotNumber
mouseModule.mouseController.DeattachObject()
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.AUTO_HUNT_CANT_DO_THAT)
self.__Refresh()
def __OverInSkill(self, index):
skillDict = self.__children["skillDict"] if self.__children.has_key("skillDict") else {}
if not skillDict.has_key(index):
return
skillNumber = skillDict[index]
interface = constInfo.GetInterfaceInstance()
if interface:
if interface.tooltipSkill:
interface.tooltipSkill.SetSkillNew(skillNumber, player.GetSkillIndex(skillNumber), player.GetSkillGrade(skillNumber), player.GetSkillLevel(skillNumber))
def __OverInItem(self, itemIdx = 0):
# Identificăm care slot din cele 3 este sub mouse
slotKey = -1
for k, v in slotItemDict.items():
if v == itemIdx:
slotKey = k
break
if slotKey == -1:
return
# Curățăm ce a fost înainte
self.tooltipCustom.ClearToolTip()
# Preluăm datele din localeInfo folosind cheile dinamice
titleKey = "AUTO_HUNT_TOOLTIP_TITLE_%d" % slotKey
descKey = "AUTO_HUNT_TOOLTIP_DESC_%d" % slotKey
# Titlul (va fi sus și centrat)
self.tooltipCustom.SetTitle(getattr(localeInfo, titleKey, "Item"))
# Descrierea (va face wrap automat sub titlu)
self.tooltipCustom.AddDescription(getattr(localeInfo, descKey, ""))
# Calculăm mărimea finală a ThinBoardGold și îl afișăm
self.tooltipCustom.ResizeAndShow()
def __OverOut(self):
# Curățăm și ștergem textele tooltip-ului custom imediat ce scoatem mouse-ul
if self.tooltipCustom:
self.tooltipCustom.ClearToolTip() # Aici șterge liniile de text și ascunde board-ul
# Păstrăm restul logicii pentru tooltip-urile de skill și iteme normale
interface = constInfo.GetInterfaceInstance()
if interface:
if interface.tooltipItem:
interface.tooltipItem.HideToolTip()
if interface.tooltipSkill:
interface.tooltipSkill.HideToolTip()
def Open(self):
if not (self.__children["serverUpdate"] if self.__children.has_key("serverUpdate") else False):
self.__children["serverUpdate"] = 1
self.__SendCommand("update")
return
self.__Refresh()
self.Show()
self.SetTop()
def Close(self):
miniMap.SetAutoHuntRangeStatus(False)
self.Hide()
def OnPressEscapeKey(self):
self.Close()
return True
def FormatTime(seconds):
if seconds <= 0:
return "0s"
m, s = divmod(seconds, 60)
h, m = divmod(m, 60)
d, h = divmod(h, 24)
text = ""
if d > 0:
text+="{}d ".format(d)
if h > 0:
text+="{}h ".format(h)
if m > 0:
text+="{}m ".format(m)
if s > 0:
text+="{}s ".format(s)
return text[:len(text)-1] if len(text) > 0 else "0s"
def CreateWindow(window, parent, windowFlags, windowPos, windowArgument = "", windowPositionRule = "", windowSize = (-1, -1), windowFontName = -1, windowColor = -1):
if parent:
window.SetParent(parent)
for flag in windowFlags:
window.AddFlag(flag)
if windowSize != (-1, -1):
window.SetSize(*windowSize)
if windowPositionRule:
splitList = windowPositionRule.split(":")
if len(splitList) == 2:
(type, mode) = (splitList[0], splitList[1])
if type == "all":
window.SetHorizontalAlignCenter()
window.SetVerticalAlignCenter()
window.SetWindowHorizontalAlignCenter()
window.SetWindowVerticalAlignCenter()
elif type == "horizontal":
if isinstance(window, ui.TextLine):
if mode == "center":
window.SetHorizontalAlignCenter()
elif mode == "right":
window.SetHorizontalAlignRight()
elif mode == "left":
window.SetHorizontalAlignLeft()
else:
if mode == "center":
window.SetWindowHorizontalAlignCenter()
elif mode == "right":
window.SetWindowHorizontalAlignRight()
elif mode == "left":
window.SetWindowHorizontalAlignLeft()
elif type == "vertical":
if isinstance(window, ui.TextLine):
if mode == "center":
window.SetVerticalAlignCenter()
elif mode == "top":
window.SetVerticalAlignTop()
elif mode == "bottom":
window.SetVerticalAlignBottom()
else:
if mode == "top":
window.SetWindowVerticalAlignTop()
elif mode == "center":
window.SetWindowVerticalAlignCenter()
elif mode == "bottom":
window.SetWindowVerticalAlignBottom()
if windowArgument:
if isinstance(window, ui.TextLine):
if windowFontName != -1:
window.SetFontName(windowFontName)
window.SetText(windowArgument)
elif isinstance(window, ui.AniImageBox):
for image in windowArgument:
window.AppendImage(image)
elif isinstance(window, ui.NumberLine):
window.SetNumber(windowArgument)
elif isinstance(window, ui.Button) or isinstance(window, ui.RadioButton) or isinstance(window, ui.ToggleButton):
if isinstance(windowArgument, list):
window.SetUpVisual(windowArgument[0])
window.SetOverVisual(windowArgument[1] if len(windowArgument) >= 2 else windowArgument[0])
window.SetDownVisual(windowArgument[2] if len(windowArgument) >= 3 else windowArgument[0])
if len(windowArgument) == 4:
window.SetDisableVisual(windowArgument[3])
elif isinstance(window, ui.ExpandedImageBox) or isinstance(window, ui.ImageBox):
window.LoadImage(windowArgument if windowArgument.find("gr2") == -1 else "icon/item/27995.tga")
if windowColor != -1:
if isinstance(window, ui.TextLine):
window.SetPackedFontColor(windowColor)
window.SetPosition(*windowPos)
window.Show()
return window
NEW_AFFECT_AUTO_HUNT Auto Hunt SNA
AUTO_HUNT_TITLE |cFF00FFFF|h[|r|cFFFFFFFF|hAuto Hunt v3|r|cFF00FFFF|h]|r
AUTO_HUNT_SKILLS |cFFFF6961Abilitati|r
AUTO_HUNT_ITEMS |cFFCD853FConsumabile|r
AUTO_HUNT_RESET Reseteaza
AUTO_HUNT_OPTION |cFFFFB266Optiuni|r
AUTO_HUNT_START |cFF77DD77Porneste|r
AUTO_HUNT_STOP |cFFFF6961Opreste|r
AUTO_HUNT_RANGE |cFFFF6961Raza|r
AUTO_HUNT_MOB_FARM |cFF00FF00Mob |r|cFFFFFFFFFarm|r
AUTO_HUNT_STONE_FARM |cFF00FFFFStone |r|cFFFFFFFFFarm|r
AUTO_HUNT_AUTO_LOGIN |cFFFFFFFFAuto |r|cFFFFB266Login|r
AUTO_HUNT_CANT_DO_THAT |cFFFF4500Nu poti face asta in timp ce Auto Hunt este activ!|r
AUTO_HUNT_DURATION Durata
AUTO_HUNT_LEFTTIME |cFF00FF00Mob:|r |cFFFFFF00{}|r |cFFFFFFFF | |r |cFF00FFFFStone:|r |cFFFFFF00{}
AUTO_HUNT_TOOLTIP_TITLE_0 |cffFEE3AEMantia Curajului|r
AUTO_HUNT_TOOLTIP_DESC_0 Acest item permite |cffFFFF00utilizarea automata|r a mantiei. Raza de actiune este influentata de |cff00FF00setarile sistemului|r. Ai grija sa ai destule mantii in inventar!
AUTO_HUNT_TOOLTIP_TITLE_1 |cffFEE3AEInelul Experientei|r
AUTO_HUNT_TOOLTIP_DESC_1 Ofera experienta in functie de ce inel ai in inventar |cffffff00+50%/100%|r pentru 30/60 de minute. Se consuma daca nu este deja activa si se reactiveaza daca cumva a expirat si exista deja in inventar.
AUTO_HUNT_TOOLTIP_TITLE_2 |cffFEE3AEManusa Talharului|r
AUTO_HUNT_TOOLTIP_DESC_2 Aceasta ofera un bonus suplimentar pentru a strange yang mai mult +50%/100% in functie de item-ul respectiv.
# Bannerul la X=8 (la fel ca fundalul bg.tga)
self.__children["banner"] = CreateWindow(ui.ImageBox(), self, [], (8, 32), IMG_DIR+"banner_cave2_autohunt.png")
AUTO_HUNT_TOOLTIP_TITLE_0 |cffFEE3AEMantia Curajului|r
AUTO_HUNT_TOOLTIP_DESC_0 Acest item permite |cffFFFF00utilizarea automata|r a mantiei. Raza de actiune este influentata de |cff00FF00setarile sistemului|r. Ai grija sa ai destule mantii in inventar!
AUTO_HUNT_TOOLTIP_TITLE_1 |cffFEE3AEInelul Experientei|r
AUTO_HUNT_TOOLTIP_DESC_1 Ofera experienta in functie de ce inel ai in inventar |cffffff00+50%/100%|r pentru 30/60 de minute. Se consuma daca nu este deja activa si se reactiveaza daca cumva a expirat si exista deja in inventar.
AUTO_HUNT_TOOLTIP_TITLE_2 |cffFEE3AEManusa Talharului|r
AUTO_HUNT_TOOLTIP_DESC_2 Aceasta ofera un bonus suplimentar pentru a strange yang mai mult +50%/100% in functie de item-ul respectiv.
class CustomItemTooltip(ui.ThinBoardGold):
# REGULILE DE DESIGN:
PADDING_X = 20 # Spațiu stânga-dreapta între text și bordură
PADDING_Y = 20 # Spațiu sus-jos între text și bordură
LINE_HEIGHT = 15 # Distanța verticală între rânduri
LIMIT_WIDTH = 300 # WRAP: Dacă textul e mai lat de 300px, îl taie și trece sub
def __init__(self):
ui.ThinBoardGold.__init__(self)
self.AddFlag("not_pick")
self.AddFlag("float")
self.lines = []
self.title = None
self.maxWidthSeen = 0
self.Hide()
class CustomItemTooltip(ui.ThinBoard):
# REGULILE DE DESIGN:
PADDING_X = 20 # Spațiu stânga-dreapta între text și bordură
PADDING_Y = 20 # Spațiu sus-jos între text și bordură
LINE_HEIGHT = 15 # Distanța verticală între rânduri
LIMIT_WIDTH = 300 # WRAP: Dacă textul e mai lat de 300px, îl taie și trece sub
def __init__(self):
ui.ThinBoard.__init__(self)
self.AddFlag("not_pick")
self.AddFlag("float")
self.lines = []
self.title = None
self.maxWidthSeen = 0
self.Hide()
Zeci de resurse Metin2 Premium - exclusive și 100% funcționale începând cu 15.99€!.
Vezi resursele Cumpără premium
Trebuie să fii membru pentru a răspunde
Membrii pot crea subiecte noi și pot descărca resurse Metin2 Gratuit!
Te poți înregistra sau conecta rapid utilizând contul tău de Discord, Github sau Google.