Skip to content

Commit

Permalink
add enhancement, pets, mounts, engravings, consoidate market_data
Browse files Browse the repository at this point in the history
  • Loading branch information
gogodr committed Aug 19, 2023
1 parent 203ba3b commit 1966b5c
Show file tree
Hide file tree
Showing 20 changed files with 5,615 additions and 5,313 deletions.
2 changes: 1 addition & 1 deletion modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


class Config(metaclass=Singleton):
version = "0.8.18.5"
version = "0.8.20.2"
region: str
game_region: str
debug = False
Expand Down
6 changes: 3 additions & 3 deletions modules/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def add_entry(self, market_line: MarketLine, retries: int = 0):
market_line.avg_price = market_line.lowest_price

# Get Doc
item_doc_ref = self.db.document(
f"{Config().region}/{slugify(item['name'])}-{market_line.rarity}")
item_doc_id = f"{Config().region}/{slugify(item['name'])}-{market_line.rarity}"
item_doc_ref = self.db.document(item_doc_id)
item_doc = item_doc_ref.get()

if (item_doc.exists == False):
Expand Down Expand Up @@ -118,7 +118,7 @@ def add_entry(self, market_line: MarketLine, retries: int = 0):
'watcher_version': Config().version
})
AppLogger().info(
f"Updated: {market_line.name} | {market_line.avg_price} | {market_line.recent_price} | {market_line.lowest_price} | {market_line.cheapest_remaining}")
f"Updated: {item_doc_id} | {market_line.avg_price} | {market_line.recent_price} | {market_line.lowest_price} | {market_line.cheapest_remaining}")
if Config().play_audio:
playPulse()
except Unauthenticated as ex:
Expand Down
35 changes: 4 additions & 31 deletions modules/market.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
from thefuzz import process

from modules.market_data.engraving_recipe import engraving_recipe
from modules.market_data.enhancement_material import enhancement_material
from modules.market_data.combat_supplies import combat_supplies
from modules.market_data.cooking import cooking
from modules.market_data.trader import trader
from modules.market_data.adventurers_tome import adventurers_tome
from modules.market_data.sailing import sailing
from modules.market_data.pets import pets
from modules.market_data.mount import mount
from modules.market_data.gem_chest import gem_chest
from modules.market_data.currency_exchange import currency_exchange
from modules.market_data.other import other

market_map = {
**engraving_recipe,
**enhancement_material,
**combat_supplies,
**cooking,
**trader,
**adventurers_tome,
**sailing,
**pets,
**mount,
**gem_chest,
**currency_exchange,
**other
}

from modules.market_data.consolidated_map import consolidated_map

def filter_market_item_name(raw_name: str) -> str | None:
if(raw_name in market_map):
if(raw_name in consolidated_map):
return raw_name
result, confidence = process.extractOne(
raw_name, market_map.keys(), scorer=process.fuzz.token_sort_ratio)
raw_name, consolidated_map.keys(), scorer=process.fuzz.token_sort_ratio)
if confidence < 60:
return None
return result


def get_market_item_by_name(name: str) -> dict:
return market_map[name]
return consolidated_map[name]
Loading

0 comments on commit 1966b5c

Please sign in to comment.