def MoveToMapPosition(self, finalPosition, mapName=None, listLinks=[], callback=None, maxDist=250): if len(listLinks) == 0: if mapName == None or mapName == background.GetCurrentMapName(): OpenLog.DebugPrint("Moving to (" + str(finalPosition[0]) + "," + str(finalPosition[1]) + ") on " + str(background.GetCurrentMapName())) return Movement.GoToPositionAvoidingObjects(finalPosition[0], finalPosition[1], maxDist, callback=callback) listLinks = MapManager.GetMapPath(mapName) if len(listLinks) == 0: OpenLog.DebugPrint("Error no map found by the name: " + str(mapName)) return None self.maxDist = maxDist self.leftLinkList = listLinks self.finalPosition = finalPosition self.callback = callback self.SetStateMoving()
def ToggleMinimize(self): if background.GetCurrentMapName( ) == "map_login" or background.GetCurrentMapName() == "map_intro": chat.AppendChat(chat.CHAT_TYPE_INFO, "Du kannst die Sidebar hier nicht öffnen!") return else: if self.minimized == 1: self.minimized = 0 self.ExpandBtn.SetUpVisual( "d:/ymir work/ui/game/belt_inventory/btn_expand_normal.tga" ) self.ExpandBtn.SetOverVisual( "d:/ymir work/ui/game/belt_inventory/btn_expand_over.tga") self.ExpandBtn.SetDownVisual( "d:/ymir work/ui/game/belt_inventory/btn_expand_down.tga") else: self.minimized = 1 self.ExpandBtn.SetUpVisual( "d:/ymir work/ui/game/belt_inventory/btn_minimize_normal.tga" ) self.ExpandBtn.SetOverVisual( "d:/ymir work/ui/game/belt_inventory/btn_minimize_over.tga" ) self.ExpandBtn.SetDownVisual( "d:/ymir work/ui/game/belt_inventory/btn_minimize_down.tga" )
def CheckChangeLocation(self): currLevel = player.GetStatus(player.LEVEL) resultLoc = 0 for loc in self.locations: if loc.level > currLevel: continue if resultLoc == 0: resultLoc = loc continue if loc.level > resultLoc.level: resultLoc = loc if resultLoc != 0 and ( int(resultLoc.locationX) != int(self.startPosition[0]) or int(resultLoc.locationY) != int(self.startPosition[1]) or background.GetCurrentMapName() != resultLoc.map): chat.AppendChat( 3, "Going to " + str(resultLoc.map) + " X:" + str(resultLoc.locationX) + " Y:" + str(resultLoc.locationY)) self.SetStateWait() Movement.GoToPositionAvoidingObjects( resultLoc.locationX, resultLoc.locationY, callback=self._PositionArriveCallback, mapName=resultLoc.map) self.startPosition = (resultLoc.locationX, resultLoc.locationY) return True return False
def OnAddLocation(self): level = int(self.levelEditLine.GetText()) position = player.GetMainCharacterPosition() curr_map = background.GetCurrentMapName() loc = self.LocationCondition(level, position[0], position[1], curr_map) self.locations.add(loc) self.UpdateLocationList()
def __init__(self): self.tooltipInfo = uiMiniMap.MapTextToolTip() self.tooltipInfo.Hide() self.AtlasMainWindow = None self.board = 0 self.CurrentMapName = background.GetCurrentMapName() ui.ScriptWindow.__init__(self) self.LoadWindow()
def OnUpdate(self): (PlayerX, PlayerY, PlayerZ) = player.GetMainCharacterPosition() self.PositionText.SetText("(%s, %s)" % (int(PlayerX / 100), int(PlayerY / 100))) if background.GetCurrentMapName() != self.CurrentMapName: self.Show() self.CurrentMapName = background.GetCurrentMapName() miniMap.ShowAtlas() if not self.tooltipInfo: return self.tooltipInfo.Hide() if FALSE == self.board.IsIn(): return (mouseX, mouseY) = wndMgr.GetMousePosition() (bFind, sName, iPosX, iPosY, dwTextColor, dwGuildID) = miniMap.GetAtlasInfo(mouseX, mouseY) (PosX, PosY) = self.GetGlobalPosition() (iSizeX, iSizeY, SizeX, SizeY) = GetCurrentMapSize() if not bFind: MapSizeX = miniMap.GetAtlasSize()[1] if MapSizeX == 0: size = 6 else: size = DivideToFloat(SizeX * 256, miniMap.GetAtlasSize()[1]) height = 30 * size width = 6 * size (sName, iPosX, iPosY, dwTextColor) = "", (mouseX - PosX) * size - width, ( mouseY - PosY) * size - height, -8722595 if iPosX < 0 or iPosY < 0 or iPosX > SizeX * 256 or iPosY > SizeY * 256: return self.tooltipInfo.SetText("%s(%d, %d)" % (sName, iPosX, iPosY)) (x, y) = self.GetGlobalPosition() self.tooltipInfo.SetTooltipPosition(mouseX - x, mouseY - y) self.tooltipInfo.SetTextColor(dwTextColor) self.tooltipInfo.Show() self.tooltipInfo.SetTop()
def setMeleyMap(self): mapName = background.GetCurrentMapName() if mapName == "metin2_map_n_flame_dragon": if player.GetGuildID() != 0 and player.GetPKMode( ) != player.PK_MODE_GUILD: for btn in self.pvpModeButtonDict.values(): btn.SetUp() net.SendChatPacket("/pkmode 4", chat.CHAT_TYPE_TALKING) self.pvpModeButtonDict[player.PK_MODE_GUILD].Down()
def isMeleyMap(self, button): mapName = background.GetCurrentMapName() if mapName == "metin2_map_n_flame_dragon": if self.pvpModeButtonDict[button]: self.pvpModeButtonDict[button].SetUp() chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CANNOT_CHANGE_FIGHT_MODE) return 1 return 0
def MakeBossIcons(self): mapName = background.GetCurrentMapName() if mapName in BOSS_DATA: data = BOSS_DATA[mapName] for i in xrange(len(data)): self.bossIconList[i] = AtlasBossIcon() self.bossIconList[i].SetParent(self.AtlasMainWindow) self.bossIconList[i].SetPosition(data[i][0], data[i][1]) self.bossIconList[i].SetBossInfo(data[i][2], data[i][3], data[i][0], data[i][1]) self.bossIconList[i].Show()
def GetMapPath(map_name_end, map_name_start=background.GetCurrentMapName()): if map_name_end == map_name_start: chat.AppendChat(3, "[Map-Manager] start map and end map are the same.") return [] if map_name_start in maps and map_name_end in maps: links = maps[map_name_start].GetClosestMapPath(map_name_end) chat.AppendChat(3, str(links)) return links else: chat.AppendChat( 3, "[Map-Manager] Either " + map_name_start + " or " + map_name_end + " are not configured.") return []
def StateMapChanging(self): curr_map = background.GetCurrentMapName() if self.currLink.GetDestMapName() != curr_map: self.currLink.CrossMap() else: if len(self.leftLinkList): self.SetStateMoving() else: Movement.GoToPositionAvoidingObjects(self.finalPosition[0], self.finalPosition[1], maxDist=self.maxDist, callback=self.callback) self.callback = None self.SetState(self.STATE_NONE)
def GetClosestMapPathWithNPC(npc_race, map_name_start=background.GetCurrentMapName()): if map_name_start in maps: links = maps[map_name_start].GetClosestMapPathWithNPC(npc_race) if isinstance(links, Map): return [], links.map_name if type(links) == list: if len(links) == 0: return [], None return links, links[-1].GetDestMapName() return [], None else: chat.AppendChat( 3, "[Map-Manager] Map " + map_name_start + " is not configured.") return [], None
def OnUpdate(self): if self.State == self.STATE_NONE or not OpenLib.IsInGamePhase(): return val, self.generalTimer = OpenLib.timeSleep(self.generalTimer, TIME_WAIT_MAP_CHANGE) if not val: return if self.State == self.STATE_MOVING: OpenLog.DebugPrint("[MAP] - State Moving") if self.currLink.GetOriginMapName( ) != background.GetCurrentMapName(): self.SetStateMapChanging() return if self.State == self.STATE_MAPCHANGING: OpenLog.DebugPrint("[MAP] - State Map Changing") self.StateMapChanging()
def __IsSpecialMap(self): dis_maps = [ "season1/metin2_map_oxevent", "season2/metin2_map_guild_inside01", "season2/metin2_map_empirewar01", "season2/metin2_map_empirewar02", "season2/metin2_map_empirewar03", "metin2_map_dragon_timeattack_01", "metin2_map_dragon_timeattack_02", "metin2_map_dragon_timeattack_03", "metin2_map_skipia_dungeon_boss", "metin2_map_skipia_dungeon_boss2", "metin2_map_devilsCatacomb", "metin2_map_deviltower1", "metin2_map_t1", "metin2_map_t2", "metin2_map_t3", "metin2_map_t4", "metin2_map_t5", "metin2_map_wedding_01", "metin2_map_duel", "metin2_map_orclabyrinth", "metin2_map_n_flame_dungeon_01", "metin2_map_n_snow_dungeon_01" ] if str(background.GetCurrentMapName()) in dis_maps: return TRUE return FALSE
def GetCurrentMapSize(): global MapBuffer ActualMapName = background.GetCurrentMapName() if ActualMapName in MapBuffer: return MapBuffer[ActualMapName] else: (bGet, iSizeX, iSizeY) = miniMap.GetAtlasSize() GetMapData = str(OpenLib.EterPackOperator("atlasinfo.txt").read()) MapData = GetMapData.split("\n") for Map in MapData: try: MapName = Map.split("\t")[0] SizeX = int(Map.split("\t")[3]) SizeY = int(Map.split("\t")[4]) if MapName == ActualMapName: if iSizeX == 0 or iSizeY == 0: iSizeX = SizeX * 43 iSizeY = SizeY * 43 break except: pass MapBuffer[ActualMapName] = (iSizeX, iSizeY, SizeX, SizeY) return (iSizeX, iSizeY, SizeX, SizeY)
def GetMap(map_name=background.GetCurrentMapName()): if map_name in maps: return maps[map_name] else: return None