Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.2.5 #145

Merged
merged 24 commits into from
Nov 7, 2024
Merged

1.2.5 #145

Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/windows-exe-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build Windows Executable

env:
AAA_VERSION: "1.2.4"
AAA_VERSION: "1.2.5"

on:
workflow_dispatch:
Expand Down
3 changes: 1 addition & 2 deletions AzerothAuctionAssassin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
from datetime import datetime

AAA_VERSION = "1.2.4"
AAA_VERSION = "1.2.5"

windowsApp_Path = None
try:
Expand Down Expand Up @@ -1425,7 +1425,6 @@ def import_ilvl_data(self):

try:
with open(pathname) as file:
a = self.ilvl_list
self.ilvl_list += json.load(file)
if not isinstance(self.ilvl_list, list):
raise ValueError(
Expand Down
25 changes: 25 additions & 0 deletions mega_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ def pull_single_realm_data(connected_id):
# old method
# id_msg += f"`Name:` {item_name}\n"
embed_name = item_name
if (
"required_lvl" in auction
and auction["required_lvl"] is not None
):
id_msg += f"`required_lvl:` {auction['required_lvl']}\n"
else:
id_msg = f"`petID:` {auction['petID']}\n"
saddlebag_link_id = auction["petID"]
Expand Down Expand Up @@ -277,6 +282,14 @@ def check_tertiary_stats_generic(
):
if "bonus_lists" not in auction["item"]:
return False

# Check for a modifier with type 9 and get its value (modifier 9 value equals playerLevel)
required_lvl = None
for modifier in auction["item"].get("modifiers", []):
if modifier["type"] == 9:
required_lvl = modifier["value"]
break

item_bonus_ids = set(auction["item"]["bonus_lists"])
# look for intersection of bonus_ids and any other lists
tertiary_stats = {
Expand Down Expand Up @@ -317,6 +330,16 @@ def check_tertiary_stats_generic(
if ilvl < min_ilvl:
return False

# skip if required_lvl is too high
if required_lvl and required_lvl > DESIRED_ILVL_ITEMS["required_lvl"]:
return False

# if no modifier["type"] == 9 found, use the base required level for report
if not required_lvl:
required_lvl = DESIRED_ILVL_ITEMS["base_required_levels"][
auction["item"]["id"]
]

# if we get through everything and still haven't skipped, add to matching
buyout = round(auction["buyout"] / 10000, 2)
if buyout > DESIRED_ILVL_ITEMS["buyout"]:
Expand All @@ -328,6 +351,7 @@ def check_tertiary_stats_generic(
"tertiary_stats": tertiary_stats,
"bonus_ids": item_bonus_ids,
"ilvl": ilvl,
"required_lvl": required_lvl,
}

def format_alert_messages(
Expand Down Expand Up @@ -462,6 +486,7 @@ def ilvl_results_dict(
"tertiary_stats": tertiary_stats,
"bonus_ids": auction["bonus_ids"],
"ilvl": auction["ilvl"],
"required_lvl": auction["required_lvl"],
}

#### MAIN ####
Expand Down
6 changes: 5 additions & 1 deletion utils/api_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ def get_ilvl_items(ilvl=201, item_ids=[]):
base_ilvls = {
int(itemID): item_info["ilvl"] for itemID, item_info in results.items()
}
return item_names, set(item_names.keys()), base_ilvls
base_required_levels = {
int(itemID): item_info["required_level"]
for itemID, item_info in results.items()
}
return item_names, set(item_names.keys()), base_ilvls, base_required_levels


def simple_snipe(json_data):
Expand Down
25 changes: 19 additions & 6 deletions utils/mega_data_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,33 +341,40 @@ def __set_desired_ilvl_list(self, path_to_data=None):
for ilvl, item_id_groups in ilvl_groups.items():
# Flatten the list of item ids
all_item_ids = [item_id for group in item_id_groups for item_id in group]
item_names, item_ids, base_ilvls = get_ilvl_items(ilvl, all_item_ids)
item_names, item_ids, base_ilvls, base_required_levels = get_ilvl_items(
ilvl, all_item_ids
)

for item in ilvl_info:
if item["ilvl"] == ilvl:
snipe_info, min_ilvl = self.__set_desired_ilvl(
item, item_names, base_ilvls
item, item_names, base_ilvls, base_required_levels
)
DESIRED_ILVL_LIST.append(snipe_info)

# broad groups
if broad_groups:
# with a broad group we dont care about ilvl or item_ids
# its the same generic info for all of them
item_names, item_ids, base_ilvls = get_ilvl_items()
item_names, item_ids, base_ilvls, base_required_levels = get_ilvl_items()
# add the item names an base ilvl to each broad group
for item in broad_groups:
snipe_info, min_ilvl = self.__set_desired_ilvl(
item, item_names, base_ilvls
item, item_names, base_ilvls, base_required_levels
)
DESIRED_ILVL_LIST.append(snipe_info)

return DESIRED_ILVL_LIST

def __set_desired_ilvl(self, ilvl_info, item_names, base_ilvls):
def __set_desired_ilvl(
self, ilvl_info, item_names, base_ilvls, base_required_levels
):
if "item_ids" not in ilvl_info.keys():
cohenaj194 marked this conversation as resolved.
Show resolved Hide resolved
ilvl_info["item_ids"] = []

if "required_lvl" not in ilvl_info.keys():
cohenaj194 marked this conversation as resolved.
Show resolved Hide resolved
ilvl_info["required_lvl"] = 1000

example = {
"ilvl": 360,
"buyout": 50000,
Expand All @@ -376,6 +383,7 @@ def __set_desired_ilvl(self, ilvl_info, item_names, base_ilvls):
"leech": False,
"avoidance": False,
"item_ids": [12345, 67890],
"required_lvl": 1000,
cohenaj194 marked this conversation as resolved.
Show resolved Hide resolved
}

if ilvl_info.keys() != example.keys():
Expand All @@ -385,7 +393,7 @@ def __set_desired_ilvl(self, ilvl_info, item_names, base_ilvls):

snipe_info = {}
bool_vars = ["sockets", "speed", "leech", "avoidance"]
int_vars = ["ilvl", "buyout"]
int_vars = ["ilvl", "buyout", "required_lvl"]
for key, value in ilvl_info.items():
if key in bool_vars:
if isinstance(ilvl_info[key], bool):
Expand All @@ -402,6 +410,7 @@ def __set_desired_ilvl(self, ilvl_info, item_names, base_ilvls):
snipe_info["item_names"] = item_names
snipe_info["item_ids"] = set(item_names.keys())
snipe_info["base_ilvls"] = base_ilvls
snipe_info["base_required_levels"] = base_required_levels
else:
snipe_info["item_names"] = {
item_id: item_names[item_id] for item_id in ilvl_info["item_ids"]
Expand All @@ -410,6 +419,10 @@ def __set_desired_ilvl(self, ilvl_info, item_names, base_ilvls):
snipe_info["base_ilvls"] = {
item_id: base_ilvls[item_id] for item_id in ilvl_info["item_ids"]
}
snipe_info["base_required_levels"] = {
item_id: base_required_levels[item_id]
for item_id in ilvl_info["item_ids"]
}

return snipe_info, ilvl_info["ilvl"]

Expand Down
Loading