From 823ec2008fa3958971d8b736dad5ffb767f1d7d8 Mon Sep 17 00:00:00 2001 From: aronwk-aaron Date: Sun, 26 May 2024 22:49:32 -0500 Subject: [PATCH] util command to get mission/ach awards that aren't in honor accollade --- app/__init__.py | 4 +++- app/commands.py | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index d1589fa..9b8aef3 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -19,7 +19,8 @@ from app.commands import ( gen_image_cache, gen_model_cache, fix_clone_ids, - remove_buffs + remove_buffs, + find_missing_commendation_items ) from app.models import Account, AccountInvitation, AuditLog @@ -96,6 +97,7 @@ def create_app(): app.cli.add_command(gen_model_cache) app.cli.add_command(fix_clone_ids) app.cli.add_command(remove_buffs) + app.cli.add_command(find_missing_commendation_items) register_logging(app) register_settings(app) diff --git a/app/commands.py b/app/commands.py index a5b72da..3ac317b 100644 --- a/app/commands.py +++ b/app/commands.py @@ -4,7 +4,7 @@ import random import string import datetime from flask_user import current_app -from app import db +from app import db, luclient from app.models import Account, PlayKey, CharacterInfo, Property, PropertyContent, UGC, Mail, CharacterXML import pathlib import zlib @@ -281,3 +281,41 @@ def find_or_create_account(name, email, password, gm_level=9): db.session.add(play_key) db.session.commit() return # account + +@click.command("find_missing_commendation_items") +@with_appcontext +def find_missing_commendation_items(): + data = dict() + lots = set() + reward_items = luclient.query_cdclient("Select reward_item1 from Missions;") + for reward_item in reward_items: + lots.add(reward_item[0]) + reward_items = luclient.query_cdclient("Select reward_item2 from Missions;") + for reward_item in reward_items: + lots.add(reward_item[0]) + reward_items = luclient.query_cdclient("Select reward_item3 from Missions;") + for reward_item in reward_items: + lots.add(reward_item[0]) + reward_items = luclient.query_cdclient("Select reward_item4 from Missions;") + for reward_item in reward_items: + lots.add(reward_item[0]) + lots.remove(0) + lots.remove(-1) + + for lot in lots: + itemcompid = luclient.query_cdclient( + "Select component_id from ComponentsRegistry where component_type = 11 and id = ?;", + [lot], + one=True + )[0] + + itemcomp = luclient.query_cdclient( + "Select commendationLOT, commendationCost from ItemComponent where id = ?;", + [itemcompid], + one=True + ) + if itemcomp[0] is None or itemcomp[1] is None: + data[lot] = {"name": luclient.get_lot_name(lot)} + print(data) + +