def getRecommendChampListHTML(self): html_blob = str() if self.recommend_champ_list is not None: for champ in self.recommend_champ_list: html_str = ChampionBasicInfo.getInstance().toHtml(champ[0], champ[1]) html_blob += html_str return html_blob
def mixedWrapper(champ_name, gears_set): champ_img_html = ChampionBasicInfo.getInstance().toImgHtml(champ_name) actual_gears = list() if gears_set is not None: actual_gears = list(set(gears_set) - set(NONE_LIST)) if len(actual_gears) == 0: actual_gears.append("Nothing") gear_img_html = GearsBasicInfo.getInstance().toImgHtml(actual_gears) return "<div class=\"mixed\">" + champ_img_html + gear_img_html + "</div><hr/>"
def getEnemyTeamListSimpleHTML(self): html_blob = str() for champ in self.enemy_team_champ_list: html_str = ChampionBasicInfo.getInstance().toSimpleHtml(champ) html_blob += html_str return html_blob
def getEnemyBannedChampListHTML(self): html_blob = str() for champ in self.enemy_banned_champ_list: html_str = ChampionBasicInfo.getInstance().toHtml(champ) html_blob += html_str return html_blob
def getEnemyInfoHTML(self): html_blob = str() for champ in self.enemy_info: html_str = ChampionBasicInfo.getInstance().toHtml(champ) html_blob += html_str return html_blob
def getYourselfChampHTML(self): return ChampionBasicInfo.getInstance().toHtml(self.yourself_champ)
def analysisEnemyPosition(self): names = list(self.enemy_position_deque.keys()) if self.user_position == 'TOP': position = (33, 36) elif self.user_position == 'JUNGLE': position = [(84, 75), (171, 180)] elif self.user_position == 'MID': position = (125, 127) else: position = (222, 221) if self.user_position != 'JUNGLE': for name in names: distance = [] moving_vectors = [] enemyPosition = list(self.enemy_position_deque[name]) # 删除最后消失的时间 for i in range(5): if enemyPosition[-1] == (-1, -1): del enemyPosition[-1] if len(enemyPosition) < 2: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is missing") self.warning_priority_queue.put((2, warning_html)) continue # 删除之前消失的时间 for item in enemyPosition: if item == (-1, -1): enemyPosition.remove(item) if len(enemyPosition) > 3: for i in range(len(enemyPosition)): distance.append( np.square(position[0] - enemyPosition[i][0]) + np.square(position[1] - enemyPosition[i][1])) for i in range(len(distance) - 1): if distance[i] - distance[i + 1] > 0: moving_vectors.append(0) else: moving_vectors.append(1) if not any(moving_vectors): warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is moving towards you") self.warning_priority_queue.put((3, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "focuses on your teammates.") self.warning_priority_queue.put((4, warning_html)) elif len(enemyPosition) == 3 or len(enemyPosition) == 2: for i in range(len(enemyPosition)): distance.append( np.square(position[0] - enemyPosition[i][0]) + np.square(position[1] - enemyPosition[i][1])) for i in range(len(distance) - 1): if distance[i] - distance[i + 1] > 0: moving_vectors.append(0) else: moving_vectors.append(1) if not any(moving_vectors): if 3000 < distance[0] < 15000: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is heading to you!") self.warning_priority_queue.put((1, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is moving towards you") self.warning_priority_queue.put((3, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "has no interest to you.") self.warning_priority_queue.put((5, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is missing") self.warning_priority_queue.put((2, warning_html)) else: for name in names: distance1 = [] moving_vectors1 = [] distance2 = [] moving_vectors2 = [] enemyPosition = list(self.enemy_position_deque[name]) for i in range(5): if enemyPosition[-1] == (-1, -1): del enemyPosition[-1] if len(enemyPosition) < 2: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is missing.") self.warning_priority_queue.put((2, warning_html)) continue for item in enemyPosition: if item == (-1, -1): enemyPosition.remove(item) if len(enemyPosition) > 3: for i in range(len(enemyPosition)): distance1.append(np.square(position[0][0] - enemyPosition[i][0]) + np.square( position[0][1] - enemyPosition[i][1])) distance2.append(np.square(position[1][0] - enemyPosition[i][0]) + np.square( position[1][1] - enemyPosition[i][1])) for i in range(len(distance1) - 1): if distance1[i] - distance1[i + 1] > 0: moving_vectors1.append(0) else: moving_vectors1.append(1) for i in range(len(distance2) - 1): if distance2[i] - distance2[i + 1] > 0: moving_vectors2.append(0) else: moving_vectors2.append(1) if not any(moving_vectors1): warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is moving towards Baron/Herald.") self.warning_priority_queue.put((3, warning_html)) elif not any(moving_vectors2): warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is moving towards Dragon.") self.warning_priority_queue.put((3, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "focuses on your teammates.") self.warning_priority_queue.put((4, warning_html)) elif len(enemyPosition) == 3 or len(enemyPosition) == 2: for i in range(len(enemyPosition)): distance1.append(np.square(position[0][0] - enemyPosition[i][0]) + np.square( position[0][1] - enemyPosition[i][1])) distance2.append(np.square(position[1][0] - enemyPosition[i][0]) + np.square( position[1][1] - enemyPosition[i][1])) for i in range(len(distance1) - 1): if distance1[i] - distance1[i + 1] > 0: moving_vectors1.append(0) else: moving_vectors1.append(1) for i in range(len(distance2) - 1): if distance2[i] - distance2[i + 1] > 0: moving_vectors2.append(0) else: moving_vectors2.append(1) if not any(moving_vectors1): if distance1[0] < 12000: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is heading to Baron/Herald!") self.warning_priority_queue.put((1, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is moving towards Baron/Herald.") self.warning_priority_queue.put((3, warning_html)) elif not any(moving_vectors2): if distance2[0] < 12000: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is heading to Dragon!") self.warning_priority_queue.put((1, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is moving towards Dragon.") self.warning_priority_queue.put((3, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "has no interest to Baron/Herald or Dragon.") self.warning_priority_queue.put((5, warning_html)) else: warning_html = ChampionBasicInfo.getInstance().toCustomizeHtml(name, "is missing.") self.warning_priority_queue.put((2, warning_html))