Membru Ucenic
Membru Ucenic
  • Mesaje: 37
    Membru din: 24 Feb 2025, 10:47
  • Reacții: 8
  • Mesaje utile: 0
  • Medalii

    *Problemă/Întrebare: Salut , am si eu o mica problema cand vreau sa "folosesc optiune de range" primesc crash client si syser e gol , a mai patit cineva?

    *Resursă folosită (sistem/funcție/modificare):
    system-auto-hunt-full-free-download-t5681
    *Syserr: Gold


    *Poze / Video:

    https://i.gyazo.com/7a4264b2632dcd3448a ... e2980b.gif

    Multumesc !
    Membru Ucenic
    Membru Ucenic
  • Mesaje: 37
    Membru din: 24 Feb 2025, 10:47
  • Reacții: 8
  • Mesaje utile: 0
  • Medalii

    Avatar utilizator
    Membru Ucenic
    Membru Ucenic

    Mesaj de sergiu_95 »

    up cineva?
    Membru Ucenic
    Membru Ucenic
    Mesaje: 25
    Membru din: 14 Apr 2026, 03:54
  • Reacții: 12
  • Mesaje utile: 1
  • Status: Pierd vremea ^.^
    Server: -
  • Regat: Chunjo
  • [ID Discord]
  • Contact:

    Medalii

    Avatar utilizator
    Membru Ucenic
    Membru Ucenic

    Mesaj de bebame3140 »

    sergiu_95 scrie: up cineva?
    Mă uit eu prin el, revin cu update.
    Membru Ucenic
    Membru Ucenic
    Mesaje: 25
    Membru din: 14 Apr 2026, 03:54
  • Reacții: 12
  • Mesaje utile: 1
  • Status: Pierd vremea ^.^
    Server: -
  • Regat: Chunjo
  • [ID Discord]
  • Contact:

    Medalii

    Avatar utilizator
    Membru Ucenic
    Membru Ucenic

    Mesaj de bebame3140 »

    sergiu_95 scrie: up cineva?
    Deci mai mult ca sigur e de la tine. Sincer mi-a fost lene să-l implementez pe tot, dar am implementat partea problematică cu range-ul, si a mers :

    În schimb te pot ajuta altfel. Practic ti-am trimis 3 fisiere, uiautohunt.py, minimap, si minimap module, is exact cele pe care le ai tu in resursa trimisa doar cu niste returnări syserr. Copiază si inlocuiește cu ce ți-am dat , si apoi revino cu syserr.
    uiautohunt.py
    Code:
    #author: dracaryS
    
    #static
    import ui, dbg, mouseModule, constInfo, localeInfo
    
    #dynamic
    import item, player, miniMap, chat, net, app
    
    RANGE_CIRCLE = 60.0
    RANGE_DEBUG_PREFIX = "[AUTO_HUNT_RANGE_DEBUG] "
    
    IMG_DIR = "auto_hunt/"
    
    
    slotItemDict = {
    	0 : 70038, 
    	1 : 72049, 
    	2 : 71016,
    }
    
    class Window(ui.BoardWithTitleBar):
    	__children = {}
    	def __init__(self):
    		ui.BoardWithTitleBar.__init__(self)
    		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
    		self.__children = {}
    		self.Hide()
    
    	def __LoadWindow(self):
    		self.Destroy()
    		self.AddFlag("animate")
    		self.AddFlag("float")
    		self.AddFlag("movable")
    		self.SetTitleName(localeInfo.AUTO_HUNT_TITLE)
    		self.SetCloseEvent(self.Close)
    
    		bg = CreateWindow(ui.ImageBox(), self, ["attach"], (8, 29), 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.SAFE_SetStringEvent("MOUSE_OVER_IN",self.__OverInItem, itemIdx)
    			itemImg.SAFE_SetStringEvent("MOUSE_OVER_OUT",self.__OverOut)
    			itemImg.SetEvent(self.__ClickStatus, "mouse_click", key)
    			self.__children["itemImg"+str(key)] = itemImg
    
    			status = CreateWindow(ui.ImageBox(), itemImg, [], (itemImg.GetWidth() - 12, itemImg.GetHeight() - 11), 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
    
    		optionBtn = CreateWindow(ui.ToggleButton(), bg, [], (0, 151), ["d:/ymir work/ui/public/large_button_01.sub", "d:/ymir work/ui/public/large_button_02.sub", "d:/ymir work/ui/public/large_button_03.sub"], "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
    
    		startBtn = CreateWindow(ui.RadioButton(), bg, [], (-55, 178), ["d:/ymir work/ui/public/large_button_01.sub", "d:/ymir work/ui/public/large_button_02.sub", "d:/ymir work/ui/public/large_button_03.sub"], "horizontal:center")
    		startBtn.SAFE_SetEvent(self.__StartBtn)
    		startBtn.SetText(localeInfo.AUTO_HUNT_START)
    		self.__children["startBtn"] = startBtn
    
    		stopBtn = CreateWindow(ui.RadioButton(), bg, [], (55, 178), ["d:/ymir work/ui/public/large_button_01.sub", "d:/ymir work/ui/public/large_button_02.sub", "d:/ymir work/ui/public/large_button_03.sub"], "horizontal:center")
    		stopBtn.SAFE_SetEvent(self.__StopBtn)
    		stopBtn.SetText(localeInfo.AUTO_HUNT_STOP)
    		self.__children["stopBtn"] = stopBtn
    
    		self.SetSize(8 + bg.GetWidth() + 8, 29 + bg.GetHeight() + 9)
    
    		self.__children["rangeText"] = CreateWindow(ui.TextLine(), self, [], (100, self.GetHeight()-7), localeInfo.AUTO_HUNT_RANGE)
    
    		sliderBar = CreateWindow(ui.SliderBar(), self, [], (30, self.GetHeight() + 15))
    		sliderBar.SetEvent(ui.__mem_func__(self.__OnChangeRange))
    		sliderBar.Hide()
    		self.__children["sliderBar"] = sliderBar
    		
    		self.__children["mobFarmCheckBox"] = CreateWindow(ui.ImageBox(), self, [], (30, self.GetHeight() + 15 + 18), IMG_DIR+"unselected.tga")
    		self.__children["mobFarmCheckBox"].SetEvent(ui.__mem_func__(self.__ClickOption), "mouse_click", "mob")
    		self.__children["mobFarmText"] = CreateWindow(ui.TextLine(), self, [], (30 + 15, self.GetHeight() + 15 + 20), localeInfo.AUTO_HUNT_MOB_FARM)
    
    		self.__children["stoneFarmCheckBox"] = CreateWindow(ui.ImageBox(), self, [], (30 + 100, self.GetHeight() + 15 + 18), IMG_DIR+"unselected.tga")
    		self.__children["stoneFarmCheckBox"].SetEvent(ui.__mem_func__(self.__ClickOption), "mouse_click", "stone")
    		self.__children["stoneFarmText"] = CreateWindow(ui.TextLine(), self, [], (30 + 100 + 15, self.GetHeight() + 15 + 20), localeInfo.AUTO_HUNT_STONE_FARM)
    
    		self.__children["autoLoginCheckBox"] = CreateWindow(ui.ImageBox(), self, [], (30, self.GetHeight() + 15 + 18 + 22), IMG_DIR+"unselected.tga")
    		self.__children["autoLoginCheckBox"].SetEvent(ui.__mem_func__(self.__ClickOption), "mouse_click", "auto_login")
    
    		self.__children["autoLoginText"] = CreateWindow(ui.TextLine(), self, [], (30 + 15, self.GetHeight() + 15 + 20 + 22), localeInfo.AUTO_HUNT_AUTO_LOGIN)
    
    		self.__children["mobRange"] = RANGE_CIRCLE
    
    		self.__children["newOptions"] = {
    			"auto_login" : 1,
    			"stone" : 0,
    			"mob" : 1,
    		}
    
    		self.SetStatus(0, 0, 0, 0, 0, 0, 0, 0)
    		self.__ResetBtn()
    
    		self.SetCenterPosition()
    
    	def __SendCommand(self, cmd):
    		net.SendChatPacket("/auto_hunt "+cmd)
    
    	def __RangeDebug(self, text):
    		try:
    			dbg.TraceError(RANGE_DEBUG_PREFIX + text)
    		except:
    			pass
    
    	def __SetMiniMapRangeStatus(self, status):
    		try:
    			self.__RangeDebug("SetAutoHuntRangeStatus status=%d" % (1 if status else 0))
    			miniMap.SetAutoHuntRangeStatus(status)
    			return True
    		except Exception as e:
    			self.__RangeDebug("SetAutoHuntRangeStatus failed status=%d error=%s" % (1 if status else 0, str(e)))
    			chat.AppendChat(chat.CHAT_TYPE_INFO, "Auto-Hunt range error. Check syserr.")
    			return False
    
    	def __SetMiniMapRangeValue(self, mobRange):
    		try:
    			self.__RangeDebug("SetAutoHuntRange value=%d" % int(mobRange))
    			miniMap.SetAutoHuntRange(mobRange)
    			return True
    		except Exception as e:
    			self.__RangeDebug("SetAutoHuntRange failed value=%d error=%s" % (int(mobRange), str(e)))
    			chat.AppendChat(chat.CHAT_TYPE_INFO, "Auto-Hunt range error. Check syserr.")
    			return False
    
    	#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):
    		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"]
    
    		__extraWindows = ["rangeText", "sliderBar", "autoLoginCheckBox", "mobFarmCheckBox", "mobFarmText", "stoneFarmCheckBox", "stoneFarmText", "autoLoginText"]
    		if (self.__children["rangeStatus"] if self.__children.has_key("rangeStatus") else False):
    			self.__SetMiniMapRangeStatus(True)
    			self.__children["optionBtn"].Down()
    
    			self.__children["autoLoginCheckBox"].LoadImage(IMG_DIR + "selected.tga" if self.__children["newOptions"]["auto_login"] else IMG_DIR + "unselected.tga")
    			self.__children["mobFarmCheckBox"].LoadImage(IMG_DIR + "selected.tga" if self.__children["newOptions"]["mob"] else IMG_DIR + "unselected.tga")
    			self.__children["stoneFarmCheckBox"].LoadImage(IMG_DIR + "selected.tga" if self.__children["newOptions"]["stone"] else IMG_DIR + "unselected.tga")
    
    			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)
    
    			for childName in __extraWindows:
    				self.__children[childName].Show()
    
    			self.SetSize(8 + bg.GetWidth() + 8, 29 + bg.GetHeight() + 9 + 25 + 62)
    
    		else:
    			self.__SetMiniMapRangeStatus(False)
    			self.__children["optionBtn"].SetUp()
    
    			for childName in __extraWindows:
    				self.__children[childName].Hide()
    
    			self.SetSize(8 + bg.GetWidth() + 8, 29 + bg.GetHeight() + 9)
    
    		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()
    
    		activeStatus = self.IsActive()
    		self.__children["startBtn" if activeStatus else "stopBtn"].Down()
    		self.__children["startBtn" if not activeStatus else "stopBtn"].SetUp()
    		
    		self.__RefreshLeftTime(False)
    
    	def __OnChangeRange(self):
    		if not self.IsActive():
    			sliderPos = self.__children["sliderBar"].GetSliderPos()
    			mobRange = ((1.0/RANGE_CIRCLE) * (sliderPos*RANGE_CIRCLE)) * RANGE_CIRCLE
    			self.__RangeDebug("Slider changed pos=%.3f range=%d" % (sliderPos, int(mobRange)))
    			self.__children["mobRange"] = mobRange
    			self.__SetMiniMapRangeValue(mobRange)
    		else:
    			self.__RangeDebug("Slider blocked because Auto-Hunt is active")
    			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.AUTO_HUNT_CANT_DO_THAT)
    		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)
    		mobRange = self.__children["mobRange"] if self.__children.has_key("mobRange") else 0.0
    		self.__RangeDebug("Option toggle status=%d range=%d" % (1 if self.__children["rangeStatus"] else 0, int(mobRange)))
    		self.__SetMiniMapRangeValue(mobRange)
    		self.__Refresh()
    
    	def IsActive(self):
    		return self.__children["activeStatus"] if self.__children.has_key("activeStatus") else False
    
    	def __ResetBtn(self):
    		if not self.IsActive():
    			self.__children["skillDict"] = {}
    			for key, itemIdx in slotItemDict.items():
    				self.__children["slotStatus" + str(key)] = False
    		else:
    			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.AUTO_HUNT_CANT_DO_THAT)
    		self.__Refresh()
    
    	def __StartBtn(self):
    		if not self.IsActive():
    			constInfo.autoHuntAutoLoginDict["slot"] = player.GetCharacterSlot()
    			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):
    		interface = constInfo.GetInterfaceInstance()
    		if interface:
    			if interface.tooltipItem:
    				interface.tooltipItem.SetItemToolTip(itemIdx)
    
    	def __OverOut(self):
    		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):
    		self.__SetMiniMapRangeStatus(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
    
    
    PythonMiniMap.cpp
    Code:
    # Add
    
    #ifdef __AUTO_HUNT__
    #include "PythonPlayer.h"
    #endif
    
    # Search
    
    	STATEMANAGER.SaveTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR);
    	STATEMANAGER.SaveTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
    
    # Add after
    
    #ifdef __AUTO_HUNT__
    	if (m_bAutoHuntRageStatus && !m_MiniMapAutoHuntRange.IsEmpty())
    	{
    		float calc = (1.0 / 100.0) * (m_fAutoHuntImageRadius * (m_fScale / 2.0));
    		if (calc > 1.2)
    			calc = 1.2;
    		m_MiniMapAutoHuntRange.SetScale(calc, calc);
    		const float newRadius = calc * (100.0 / 1.0);
    		m_MiniMapAutoHuntRange.SetPosition((m_fWidth - newRadius) / 2.0f + m_fScreenX, (m_fHeight - newRadius) / 2.0f + m_fScreenY);
    		m_MiniMapAutoHuntRange.SetDiffuseColor(1.0, 1.0, 1.0, 0.2);
    		m_MiniMapAutoHuntRange.Render();
    	}
    	if (CPythonPlayer::Instance().GetAutoHuntStatus() && !m_MiniMapAutoHuntStartPoint.IsEmpty())
    	{
    		const TPixelPosition* m_bAutoHuntPosition = CPythonPlayer::Instance().GetAutoHuntStartPosition();
    
    		const float calc = (1.0 / 15.0) * (15.0 * (m_fScale / 2.0));
    		m_MiniMapAutoHuntStartPoint.SetScale(calc, calc);
    	
    		const float fooCellScale = 1.0f / ((float)CTerrainImpl::CELLSCALE);
    	
    		const float fDistanceFromCenterX = (m_bAutoHuntPosition->x - m_fCenterX) * fooCellScale * m_fScale;
    		const float fDistanceFromCenterY = (m_bAutoHuntPosition->y - m_fCenterY) * fooCellScale * m_fScale;
    	
    		const float newRadius = calc * (15.0 / 1.0);
    	
    		m_MiniMapAutoHuntStartPoint.SetPosition((m_fWidth - newRadius) / 2.0f + fDistanceFromCenterX + m_fScreenX, (m_fHeight - newRadius) / 2.0f + fDistanceFromCenterY + m_fScreenY);
    		m_MiniMapAutoHuntStartPoint.Render();
    	}
    #endif
    
    # Search
    
    	pImage = (CGraphicImage*)CResourceManager::Instance().GetResourcePointer(strImageCamera.c_str());
    	m_MiniMapCameraraphicImageInstance.SetImagePointer(pImage);
    
    # ADd after
    
    #ifdef __AUTO_HUNT__
    	const std::string strImageRange = strImageRoot + "minimap_range.tga";
    	CGraphicImage* pRangeImage = (CGraphicImage*)CResourceManager::Instance().GetResourcePointer(strImageRange.c_str());
    	if (pRangeImage)
    	{
    		m_MiniMapAutoHuntRange.SetImagePointer(pRangeImage);
    		m_fAutoHuntImageRadius = pRangeImage->GetWidth();
    	}
    	else
    	{
    		TraceError("[AUTO_HUNT_RANGE_DEBUG] missing image: %s", strImageRange.c_str());
    		m_fAutoHuntImageRadius = 0.0f;
    	}
    
    	const std::string strImageStar = strImageRoot + "minimap/star.tga";
    	CGraphicImage* pStarImage = (CGraphicImage*)CResourceManager::Instance().GetResourcePointer(strImageStar.c_str());
    	if (pStarImage)
    	{
    		m_MiniMapAutoHuntStartPoint.SetImagePointer(pStarImage);
    	}
    	else
    	{
    		TraceError("[AUTO_HUNT_RANGE_DEBUG] missing image: %s", strImageStar.c_str());
    	}
    
    	m_bAutoHuntRageStatus = false;
    #endif
    
    # Search
    
    	m_MiniMapCameraraphicImageInstance.Destroy();
    
    # ADd after
    
    #ifdef __AUTO_HUNT__
    	if(!m_MiniMapAutoHuntRange.IsEmpty())
    		m_MiniMapAutoHuntRange.Destroy();
    	if(!m_MiniMapAutoHuntStartPoint.IsEmpty())
    		m_MiniMapAutoHuntStartPoint.Destroy();
    #endif
    
    # Add
    
    #ifdef __AUTO_HUNT__
    void CPythonMiniMap::ChangeAutoHuntRange(float fVal)
    {
    	if (fVal < 0.0f)
    		fVal = 0.0f;
    	if (fVal > 60.0f)
    		fVal = 60.0f;
    	m_fAutoHuntImageRadius = fVal + 40.0f;
    	__SetPosition();
    }
    #endif
    
    
    
    PythonMiniMapModule.cpp
    Code:
    # Search
    
    void initMiniMap()
    
    # Add before
    
    #ifdef __AUTO_HUNT__
    PyObject* miniMapSetAutoHuntRangeStatus(PyObject* poSelf, PyObject* poArgs)
    {
    	bool bStatus;
    	if (!PyTuple_GetBoolean(poArgs, 0, &bStatus))
    		return Py_BuildException();
    	TraceError("[AUTO_HUNT_RANGE_DEBUG] Python call SetAutoHuntRangeStatus status=%d", bStatus ? 1 : 0);
    	CPythonMiniMap::Instance().SetAutoHuntRange(bStatus);
    	return Py_BuildNone();
    }
    PyObject* miniMapSetAutoHuntRange(PyObject* poSelf, PyObject* poArgs)
    {
    	float fVal;
    	if (!PyTuple_GetFloat(poArgs, 0, &fVal))
    		return Py_BuildException();
    	TraceError("[AUTO_HUNT_RANGE_DEBUG] Python call SetAutoHuntRange value=%.2f", fVal);
    	CPythonMiniMap::Instance().ChangeAutoHuntRange(fVal);
    	return Py_BuildNone();
    }
    #endif
    
    # Search
    
    		{ NULL, NULL },
    
    # Add before
    
    #ifdef __AUTO_HUNT__
    		{ "SetAutoHuntRangeStatus",						miniMapSetAutoHuntRangeStatus,								METH_VARARGS },
    		{ "SetAutoHuntRange",						miniMapSetAutoHuntRange,								METH_VARARGS },
    #endif
    
    
    
    Scrie răspuns

    Creează-ți un cont sau autentifică-te pentru a participa la discuție

    Trebuie să fii membru pentru a răspunde

    Creează-ți un cont

    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.

    Înregistrare

    Autentifică-te

    Înapoi la “Support”

    Informații

    Utilizatori ce navighează pe acest forum: bebame3140, pepene12345 și 3 vizitatori

    Discord ID copiat: