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 TeleportAttack(self,lst,x,y): Movement.TeleportStraightLine(self.lastPos[0],self.lastPos[1],x,y) self.lastPos = (x,y) net_packet.SendStatePacket(x,y,0,net_packet.CHAR_STATE_STOP,0) vid_hits = 0 for vid in lst: mob_x, mob_y, mob_z = chr.GetPixelPosition(vid) if OpenLib.dist(x,y,mob_x,mob_y) < ATTACK_MAX_DIST_NO_TELEPORT: #chat.AppendChat(3,"Sent Attack, X:" + str(mob_x) + " Y:" + str(mob_y) + "VID: " +str(vid)) net_packet.SendAttackPacket(vid,0) lst.remove(vid) vid_hits+=1 return vid_hits
def PickUp(self): if self.pickUp: val, self.pickUpTimer = OpenLib.timeSleep(self.pickUpTimer, self.pickUpSpeed) if not val: return if OpenLib.GetCurrentPhase() != OpenLib.PHASE_GAME: return x, y, z = player.GetMainCharacterPosition() vid, itemX, itemY = net_packet.GetCloseItemGround(x, y) if vid == 0: return dst = OpenLib.dist(x, y, itemX, itemY) allowedRange = max(self.pickUpRange, OpenLib.MAX_PICKUP_DIST) if dst <= allowedRange: #Teleport to item if dst >= OpenLib.MAX_PICKUP_DIST: if not self.useRangePickup: return Movement.TeleportStraightLine(x, y, itemX, itemY) net_packet.SendPickupItem(vid) Movement.TeleportStraightLine(itemX, itemY, x, y) else: net_packet.SendPickupItem(vid)
def OnUpdate(self): val, self.lastTime = OpenLib.timeSleep(self.lastTime,self.speed) if(val and self.enableButton.isOn and not self.pause): if OpenLib.GetCurrentPhase() != OpenLib.PHASE_GAME: return isArch = self.IsWeaponArch() main_vid = net.GetMainActorVID() x,y,z = chr.GetPixelPosition(main_vid) self.lastPos = (x,y) lst = list() chat.AppendChat(3,str(len(net_packet.InstancesList))) for vid in net_packet.InstancesList: if vid == main_vid: continue if not chr.HasInstance(vid): continue if self.playerClose.isOn and chr.GetInstanceType(vid) == OpenLib.PLAYER_TYPE and vid != net.GetMainActorVID(): return if self.MetinButton.isOn and chr.GetInstanceType(vid) != OpenLib.METIN_TYPE: continue if player.GetCharacterDistance(vid) < self.range and not net_packet.IsDead(vid): lst.append(vid) hit_counter = 0 i = 0 while len(lst) > 0 and hit_counter < self.maxMonster: vid = lst[0] mob_x, mob_y, mob_z = chr.GetPixelPosition(vid) if net_packet.IsPositionBlocked(mob_x,mob_y): lst.remove(vid) continue #Checking the distance between teleports might increase the range and make it more stable if isArch: hit_counter+=self.AttackArch(lst,mob_x, mob_y) else: hit_counter+=self.TeleportAttack(lst,mob_x, mob_y) i+=1 Movement.TeleportStraightLine(self.lastPos[0],self.lastPos[1],x,y)