def getGold(self): point15 = PixelData.getPointByIndex(SysConfig.pixelIndex["gold1"]) point16 = PixelData.getPointByIndex(SysConfig.pixelIndex["gold2"]) num = point15.getInt() + point16.getInt() * 1000000 gold = int(num / 10000) silver = int((num - gold * 10000) / 100) copper = num - gold * 10000 - silver * 100 return {"gold": gold, "silver": silver, "copper": copper}
def getStatus(self): bools = PixelData.get_point_bools(SysConfig.pixelIndex["playerStatus"], 23) return { "dead": bools[0], "is_ghost": bools[1], "combat": bools[2], "ourtdoor": bools[3], "casting": bools[4], #施法 "channeled": bools[5], # 引导 # "interrupt ": bools[6], #是否可以打断 "in_party ": bools[7], "in_raid ": bools[8], "xlss_quest_complete": bools[9], "mounted": bools[10], "need_sign_xlss_letter": bools[12], "need_blue_bottom": bools[13], "need_red_bottom": bools[14], "need_cookie": bools[15], "need_water": bools[16], "need_food": bools[17], "need_gem": bools[18], "need_bandage": bools[19], "need_repair": bools[20], "flying": bools[21], "talent": bools[22], }
def strategy_random(self, got): step = UserConfig.move_step if UserConfig.move_step > 0 else random.randint(1, 3) if self.move_count % step == 0 and got.value == 0: # 没怪换角度 i = random.randint(0, 2) self.control.driver.turn_left() if i == 0 else self.control.driver.turn_right() # self.control.driver.tap_key("tab") else: right_click_pos = PixelData.get_another_resolution_point(SysConfig.move_click_pos).confoundPoint(UserConfig.point_confound_rang) if UserConfig.find_enemy_move_type == 0 and got.value == 0: self.control.driver.move_click_right(right_click_pos, 1) # x向前走两步 # self.control.driver.tap_key("tab") else: start = time.time() tick = 0 self.control.driver.tap_key_up("w") self.control.driver.tap_key_down("w") while tick < UserConfig.move_step * 3 and not Target().isEnemy(self.player.getLevel()): # self.control.driver.tap_key("tab") if got.value == 0: time.sleep(random.uniform(1.0, 3.0)) if got.value == 0: self.random_behavior() if got.value == 0: self.control.driver.turn_random() tick = time.time() - start self.control.driver.tap_key_up("w") if random.randint(0, 2) == 1: self.control.driver.tap_str(" ") # 空格是跳
def hasItem(self, itemName): keys = SysConfig.BagItems.keys() if itemName not in keys: return False b = PixelData.get_point_bools(SysConfig.pixelIndex["bagItem"], 23) if b[SysConfig.BagItems[itemName]] == 1: return True return False
def getSlotNumAndFull(self): point = PixelData.getPointByIndex(SysConfig.pixelIndex["bagSlot" + str(self.id)]) num = point.getInt() if num == 0: return {"slots": 0, "empty": 0} slots = int(num / 100) # 4位数前2位是孔数,后两位是剩余空格 empty = num % 100 return {"slots": slots, "empty": empty}
def isTouchByAnoter(self): #enemy_touch_by_other_pos = PixelData.get_another_resolution_point(UserConfig.enemy_touch_by_other_pos) x = UserConfig.enemy_touch_by_other_pos.x y = UserConfig.enemy_touch_by_other_pos.y rgb = PixelData.get_color_RGB(x, y) if 170 < rgb[0] < 220: return False return True
def hasBuff(self, buffName): keys = SysConfig.TargetBuffs.keys() if buffName not in keys: return False b = PixelData.get_point_bools(SysConfig.pixelIndex["TargetBuffs"], 23) if b[SysConfig.TargetBuffs[buffName]] == 1: return True return False
def someBodyWihsperMe(palyerName): whisper = PixelData.getPointByIndex( SysConfig.pixelIndex["sombody_whisper_me"]).getInt() if whisper > Player.whisper: Player.whisper = whisper from lib.tools.mail import sendmail from lib.base.Base import Base from run.config.UserConfig import UserConfig sendmail(UserConfig.email, palyerName + "some one whisper to me ", "", Base.screenshot("sombody_whisper_me"))
def hasDebuff(self, name): keys = SysConfig.playerDebuffs.keys() if name not in keys: return False b = PixelData.get_point_bools(SysConfig.pixelIndex["playerDebuffs"], 23) if b[SysConfig.playerDebuffs[name]] == 1: return True return False
def getSatus(self): castableBinary = PixelData.getPointByIndex(SysConfig.pixelIndex["spellCastable"]).getInt() equippedBinary = PixelData.getPointByIndex(SysConfig.pixelIndex["spellEquipped"]).getInt() notEnoughManaBinary = PixelData.getPointByIndex(SysConfig.pixelIndex["spellNotEnoughMana"]).getInt() inrangeBinary = PixelData.getPointByIndex(SysConfig.pixelIndex["sellInRange"]).getInt() spells = [] i = 23 # 13-24 和左下动作条61-72一共24个技能 while i >= 0: tmp = {} if castableBinary - math.pow(2, i) >= 0: tmp['castable'] = True castableBinary = castableBinary - math.pow(2, i) else: tmp['castable'] = False if equippedBinary - math.pow(2, i) >= 0: tmp['equipped'] = True equippedBinary = equippedBinary - math.pow(2, i) else: tmp['equipped'] = False if notEnoughManaBinary - math.pow(2, i) >= 0: tmp['notEnoughMana'] = True notEnoughManaBinary = notEnoughManaBinary - math.pow(2, i) else: tmp['notEnoughMana'] = False if inrangeBinary - math.pow(2, i) >= 0: tmp['inRange'] = True inrangeBinary = inrangeBinary - math.pow(2, i) else: tmp['inRange'] = False spells.append(tmp) i = i - 1 spells = spells[::-1] ret = {} k = 0 for slot in self.slots: ret[slot] = spells[k:k + 1][0] k = k + 1 return ret
def getStatus(self): bools = PixelData.get_point_bools(SysConfig.pixelIndex["petStatus"], 23) return { "exists": bools[0], "dead": bools[1], "combat": bools[2], "visible": bools[3], "happy": bools[4], # 猎人宠物有效 1 = unhappy, 2 = content, 3 = happy "slot4": bools[5], "slot5": bools[6], "slot6": bools[7], "slot7": bools[8], }
def getStatus(self): bools = PixelData.get_point_bools(SysConfig.pixelIndex["targetStatus"], 24) status = { "combat": bools[0], "dead": bools[1], "is_enemy": bools[2], "can_attack": bools[3], "target_me": bools[4], "is_elite": bools[5], "is_player": bools[6], # "casting": bools[7], # "channeled": bools[8], # "interrupt": bools[9] } return status
def getMaxMana(self): point = PixelData.getPointByIndex( SysConfig.pixelIndex["playerMaxMana"]) return point.getInt()
def isSkingable(self): point = PixelData.getPointByIndex(SysConfig.pixelIndex["canSkin"]) return point.getBool()
def getArea(self): return PixelData.get_points_string(SysConfig.pixelIndex["area"][0], SysConfig.pixelIndex["area"][1])
def getLevel(self): point = PixelData.getPointByIndex(SysConfig.pixelIndex["targetLevel"]) return point.getInt()
def getMaxMana(self): return PixelData.getPointByIndex( SysConfig.pixelIndex["petPowerMax"]).getInt()
def getStatus(self): bools = PixelData.get_point_bools(self.rang['start'] + 5, 23) return {"combat": bools[0], "dead": bools[1]}
def getClass(self): data = PixelData.getPointByIndex( SysConfig.pixelIndex["targetClass"]).getInt() if data > len(SysConfig.className): return "未知" return SysConfig.className[data]
def getName(self): return PixelData.get_points_string( SysConfig.pixelIndex["targetName"][0], SysConfig.pixelIndex["targetName"][1])
def IsTargetOfTargetPlayerAsNumber(self): return PixelData.getPointByIndex( SysConfig.pixelIndex["IsTargetOfTargetPlayerAsNumber"]).getInt()
def getShapeForm(self): return PixelData.getPointByIndex( SysConfig.pixelIndex["shapeForm"]).getInt()
def getMaxLife(self): return PixelData.getPointByIndex( SysConfig.pixelIndex["petHealthMax"]).getInt()
def getCurrentMana(self): return PixelData.getPointByIndex( SysConfig.pixelIndex["petPowerCurrent"]).getInt()
def getManaPercent(self): point = PixelData.getPointByIndex(self.rang["start"] + 4) rgb = self.get_color_RGB(point.x, point.y) return rgb[1]
def getMaxLife(self): point = PixelData.getPointByIndex( SysConfig.pixelIndex["targetMaxLife"]) return point.getInt()
def getCropsCoordi(self): xPoint = PixelData.getPointByIndex(self.rang['start'] + 2) yPoint = PixelData.getPointByIndex(self.rang['start'] + 3) x = xPoint.getFloat(10000) y = yPoint.getFloat(10000) return CoordiPoint(x, y)
def getCurrentMana(self): point = PixelData.getPointByIndex( SysConfig.pixelIndex["targetCurrentMana"]) return point.getInt()
def getCombatPoints(self): return PixelData.getPointByIndex( SysConfig.pixelIndex["combatPoints"]).getInt()
def getCurrentLife(self): return PixelData.getPointByIndex( SysConfig.pixelIndex["petHealthCurrent"]).getInt()