def OnUpdate(self): USE_EXCHANGE_LIMIT_RANGE = 1000 (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.xStart) > USE_EXCHANGE_LIMIT_RANGE or abs( y - self.yStart) > USE_EXCHANGE_LIMIT_RANGE: (self.xStart, self.yStart, z) = player.GetMainCharacterPosition() net.SendExchangeExitPacket()
def OnUpdate(self): (yang, coins, won, nw_coins) = bank.GetFields() self.Yang.SetText(localeInfo.NumberToBankString(player.GetElk())) self.YangBank.SetText(localeInfo.NumberToBankString(yang)) self.EpBank.SetText(localeInfo.NumberToBankString(coins)) self.Epp.SetText(localeInfo.NumberToBankString(nw_coins)) self.WonBank.SetText(localeInfo.NumberToBankString(won)) self.Wonn.SetText(localeInfo.NumberToBankString(player.GetWon())) (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.xStart) > bank.LIMIT_RANGE or abs( y - self.yStart) > bank.LIMIT_RANGE: (self.xStart, self.yStart, z) = player.GetMainCharacterPosition() self.BClose()
def OnUpdate(self): USE_SHOP_LIMIT_RANGE = 1000 (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.xShopStart) > USE_SHOP_LIMIT_RANGE or abs( y - self.yShopStart) > USE_SHOP_LIMIT_RANGE: self.__OnCloseButtonClick()
def OnUpdate(self): if not self.inven: return page = self.inven.GetInventoryPageIndex() # range 0 ~ 1 if not self.SkillBookList: return if app.ENABLE_SLOT_MARKING_SYSTEM: for index, key in self.SkillBookList.items(): if not isinstance(key, types.NoneType): i = key[1] # attached inven pos if (page * INVENTORY_PAGE_SIZE) <= i < ( (page + 1) * INVENTORY_PAGE_SIZE): # range 0 ~ 44, 45 ~ 89 lock_idx = i - (page * INVENTORY_PAGE_SIZE) self.inven.wndItem.SetCantMouseEventSlot(lock_idx) else: continue (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.StartPosX) > USE_LIMIT_RANGE or abs( y - self.StartPosY) > USE_LIMIT_RANGE: self.Close()
def OnUpdate(self): LIMIT_RANGE = 1000 (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.PositionStartX) >= LIMIT_RANGE or abs(y - self.PositionStartY) >= LIMIT_RANGE: if not self.PositionOut: self.PositionOut += 1 self.Close()
def OnUpdate(self): if not self.vid: return if systemSetting.IsShowSalesText(): if GetShopNamesRange() == 1.000: self.Show() (x, y) = chr.GetProjectPosition(self.vid, 220) self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2) else: LIMIT_RANGE = abs(constInfo.SHOPNAMES_RANGE * GetShopNamesRange()) (to_x, to_y, to_z) = chr.GetPixelPosition(self.vid) (my_x, my_y, my_z) = player.GetMainCharacterPosition() if abs(my_x - to_x) <= LIMIT_RANGE and abs( my_y - to_y) <= LIMIT_RANGE: (x, y) = chr.GetProjectPosition(self.vid, 220) self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2) self.Show() else: self.Hide() self.SetPosition(-10000, 0) else: for key in g_privateShopAdvertisementBoardDict.keys(): if player.GetMainCharacterIndex() == key: g_privateShopAdvertisementBoardDict[key].Show() x, y = chr.GetProjectPosition( player.GetMainCharacterIndex(), 220) g_privateShopAdvertisementBoardDict[key].SetPosition( x - self.GetWidth() / 2, y - self.GetHeight() / 2) else: g_privateShopAdvertisementBoardDict[key].Hide()
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 OnUpdate(self): USE_SAFEBOX_LIMIT_RANGE = 1000 (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.xSafeBoxStart) > USE_SAFEBOX_LIMIT_RANGE or abs(y - self.ySafeBoxStart) > USE_SAFEBOX_LIMIT_RANGE: self.Close()
def GetNextMonster(self): (closest_vid, _dist) = (0, 999999999) my_pos = player.GetMainCharacterPosition() for vid in net_packet.InstancesList: if not chr.HasInstance(vid): continue if net_packet.IsDead(vid): continue _type = chr.GetInstanceType(vid) monst_pos = chr.GetPixelPosition(vid) if self.ignoreBlockedPosition and net_packet.IsPositionBlocked( monst_pos[0], monst_pos[1]): continue if _type != OpenLib.MONSTER_TYPE: continue if OpenLib.dist(self.startPosition[0], self.startPosition[1], monst_pos[0], monst_pos[1]) > self.Range: continue this_dist = OpenLib.dist(my_pos[0], my_pos[1], monst_pos[0], monst_pos[1]) if this_dist < _dist: _dist = this_dist closest_vid = vid return closest_vid
def Open(self): self.SetPosition((wndMgr.GetScreenWidth() / 2) - int(math.floor(self.GetWidth() / 2.)), (wndMgr.GetScreenHeight() / 2) - int(math.floor(self.GetHeight() / 2.))) (self.xStart, self.yStart, z) = player.GetMainCharacterPosition() self.Show()
def ShowWindow(self, size): (self.xSafeBoxStart, self.ySafeBoxStart, z) = player.GetMainCharacterPosition() self.SetTableSize(size) self.Show()
def Open(self, vid): isPrivateShop = FALSE isMainPlayerPrivateShop = FALSE import chr if chr.IsNPC(vid): isPrivateShop = FALSE else: isPrivateShop = TRUE if player.IsMainCharacterIndex(vid): isMainPlayerPrivateShop = TRUE self.btnBuy.Hide() self.btnSell.Hide() self.btnClose.Show() else: isMainPlayerPrivateShop = FALSE self.btnBuy.Show() self.btnSell.Show() self.btnClose.Hide() shop.Open(isPrivateShop, isMainPlayerPrivateShop) self.tabIdx = 0 if isPrivateShop: self.__HideMiddleTabs() self.__HideSmallTabs() else: if shop.GetTabCount() == 1: self.__ShowBuySellButton() self.__HideMiddleTabs() self.__HideSmallTabs() elif shop.GetTabCount() == 2: self.__HideBuySellButton() self.__ShowMiddleTabs() self.__HideSmallTabs() self.__SetTabNames() self.middleRadioButtonGroup.OnClick(0) elif shop.GetTabCount() == 3: self.__HideBuySellButton() self.__HideMiddleTabs() self.__ShowSmallTabs() self.__SetTabNames() self.middleRadioButtonGroup.OnClick(1) self.Refresh() self.SetTop() self.Show() (self.xShopStart, self.yShopStart, z) = player.GetMainCharacterPosition()
def OpenDialog(self): self.TitleName.SetText(locale.EXCHANGE_TITLE % (exchange.GetNameFromTarget())) self.AcceptButton.Enable() self.AcceptButton.SetUp() self.Show() (self.xStart, self.yStart, z) = player.GetMainCharacterPosition()
def Open(self): self.PositionOut = 0 (self.PositionStartX, self.PositionStartY, z) = player.GetMainCharacterPosition() for i in xrange(sash.WINDOW_MAX_MATERIALS + 1): self.sashSlot.ClearSlot(i) self.Show()
def GetNpcFromMap(map_name, npc_race, position=player.GetMainCharacterPosition()): #OpenLog.DebugPrint("Searching NPC race:"+str(npc_race) + " on map " + str(map_name)) map = GetMap(map_name) if map != None and map.HasNPC(npc_race): return map.GetNpcPositionClosest(npc_race, position[0], position[1]) return None
def OnUpdate(self): (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.xGemShopStart) > self.GEM_SHOP_WINDOW_LIMIT_RANGE or abs(y - self.yGemShopStart) > self.GEM_SHOP_WINDOW_LIMIT_RANGE: self.Close() if player.GetGemShopRefreshTime() > 0: self.refreshTime.SetText(self.TransformTime(int(self.lastUpdate - app.GetGlobalTime())/1000)) else: self.refreshTime.SetText("00:00")
def GetTmpTeleport(DestX, DestY): (PlayerX, PlayerY, PlayerZ) = player.GetMainCharacterPosition() DifX = DestX - PlayerX DifY = DestY - PlayerY Vektor = DivideToFloat(2000, math.sqrt(DifX**2 + DifY**2)) TempX = PlayerX + Vektor * DifX TempY = PlayerY + Vektor * DifY Count = DivideToFloat((DestX - PlayerX), (Vektor * DifX)) return (TempX, TempY, Count)
def Open(self): self.PositionOut = 0 (self.PositionStartX, self.PositionStartY, z) = player.GetMainCharacterPosition() self.needMoney.SetText(localeInfo.SASH_REFINE_COST % (sash.GetPrice())) for i in xrange(sash.WINDOW_MAX_MATERIALS + 1): self.sashSlot.ClearSlot(i) self.Show()
def Open(self): self.RefreshItemSlot() self.SetTop() self.Show() (self.xGemShopStart, self.yGemShopStart, z) = player.GetMainCharacterPosition() self.lastUpdate = app.GetGlobalTime() + player.GetGemShopRefreshTime()*1000
def Open(self, vid): self.Refresh() self.SetTop() self.Show() # Set Title Name self.titleName.SetText(chr.GetNameByVID(vid)) (self.xShopStart, self.yShopStart, z) = player.GetMainCharacterPosition()
def ShowWindow(self, size): (self.xSafeBoxStart, self.ySafeBoxStart, z) = player.GetMainCharacterPosition() self.SetTableSize(size) self.Show() if app.ENABLE_GROWTH_PET_SYSTEM: player.SetOpenMall(True)
def Open(self): self.PositionOut = 0 (self.PositionStartX, self.PositionStartY, z) = player.GetMainCharacterPosition() self.cost.SetText(localeInfo.CHANGE_LOOK_COST % (self.NumberToMoneyString(changelook.GetCost()))) for i in xrange(changelook.WINDOW_MAX_MATERIALS): self.slot.ClearSlot(i) self.Show()
def Open(self): if self.IsOpened(): return for i in xrange(5): self.AddRank(i, "", "", "", "") self.PositionOut = 0 (self.PositionStartX, self.PositionStartY, z) = player.GetMainCharacterPosition() self.Show()
def Open(self): self.cubeItemInfo = {} self.cubeResultInfos = [] self.cubeMaterialInfos = {} self.Refresh() self.Show() self.isUsable = True (self.xShopStart, self.yShopStart, z) = player.GetMainCharacterPosition()
def ShowWindow(self, size): if app.WJ_ENABLE_TRADABLE_ICON: self.interface.SetOnTopWindow(player.ON_TOP_WND_SAFEBOX) self.interface.RefreshMarkInventoryBag() (self.xSafeBoxStart, self.ySafeBoxStart, z) = player.GetMainCharacterPosition() self.SetTableSize(size) self.Show()
def OpenDialog(self): self.TitleName.SetText(localeInfo.EXCHANGE_TITLE % (exchange.GetNameFromTarget())) self.AcceptButton.Enable() self.AcceptButton.SetUp() self.Show() if app.WJ_ENABLE_TRADABLE_ICON: self.interface.SetOnTopWindow(player.ON_TOP_WND_EXCHANGE) self.interface.RefreshMarkInventoryBag() (self.xStart, self.yStart, z) = player.GetMainCharacterPosition()
def RotateMainCharacter(x, y): """ Rotate main character to (x,y) Args: x ([float]): X coordinate of destination. y ([float]): Y coordinate of destination. """ my_x, my_y, my_z = player.GetMainCharacterPosition() chr.SelectInstance(player.GetMainCharacterIndex()) rot = GetRotation(my_x, my_y, x, y) chr.SetRotation(rot)
def StartStopEvent(self, val): if not val: NPCInteraction.StopAction() self.exitFishing() else: self.startPosition = player.GetMainCharacterPosition() #net_packet.BlockFishingPackets() chat.AppendChat( 3, "[Fishing-bot] ATTENTION, you should only have one rod in you inventory!" ) self.startFishing()
def BuyItemDirectly(self, item): vid = item.shop slot = item.slot x, y, z = player.GetMainCharacterPosition() dst_x, dst_y, dst_z = chr.GetPixelPosition(vid) if (dst_x + dst_y < 0.000001): return Movement.TeleportStraightLine(x, y, dst_x, dst_y) net.SendOnClickPacket(vid) net.SendShopBuyPacket(slot) Movement.TeleportStraightLine(dst_x, dst_y, x, y) net.SendShopEndPacket()
def Open(self): if app.ENABLE_SLOT_MARKING_SYSTEM: self.interface.SetOnTopWindow(player.ON_TOP_WND_COMBINE) self.interface.RefreshMarkInventoryBag() self.PositionOut = 0 (self.PositionStartX, self.PositionStartY, z) = player.GetMainCharacterPosition() self.needMoney.SetText(localeInfo.ACCE_ABSORB_COST % (acce.GetPrice())) self.ClearAllSlots() self.SetCenterPosition() self.SetTop() self.Show()