diff --git a/bin/mharmor.py b/bin/mharmor.py index cacad9f..15facbc 100755 --- a/bin/mharmor.py +++ b/bin/mharmor.py @@ -86,7 +86,7 @@ def find_armors(args): sys.exit(1) a.set_skills(skills) # calculate total using decorations for first skill only. This - # works great if all skill shave same slot values; if not it's + # works great if all skill have same slot values; if not it's # very messy to figure out what is 'best' total = 0 first = True diff --git a/mhapi/db.py b/mhapi/db.py index 12233fb..4fca2e4 100644 --- a/mhapi/db.py +++ b/mhapi/db.py @@ -364,7 +364,8 @@ class MHDB(object): """, (parent_id,), model_cls=model.Weapon) def get_armors(self): - return self._query_all("armors", MHDB._armor_select, + return self._query_all("armors", MHDB._armor_select + """ + WHERE items.name != items.name_jp""", model_cls=model.Armor) def get_armor(self, armor_id): @@ -454,6 +455,7 @@ class MHDB(object): AND item_to_skill_tree.skill_tree_id IN (%s) AND item_to_skill_tree.point_value > 0 AND armor.hunter_type IN ('Both', ?) + AND items.name != items.name_jp GROUP BY item_to_skill_tree.item_id """ % placeholders, tuple(args), model_cls=model.Armor) @@ -516,6 +518,10 @@ class MHDB(object): item_results = [item_results] for item_data in item_results: ccomps = self.get_item_components(item_data.id, "Create") + if not ccomps: + # might be two possible ways of making the item, just + # get the first one for now + ccomps = self.get_item_components(item_data.id, "Create A") if item_data["type"] == "Weapon": # only weapons have upgrade components ucomps = self.get_item_components(item_data.id, "Improve") diff --git a/mhapi/model.py b/mhapi/model.py index f41d995..7fefb39 100644 --- a/mhapi/model.py +++ b/mhapi/model.py @@ -274,6 +274,9 @@ class Armor(ItemWithSkills): def skill(self, skill_id_or_name, decoration_values=()): """ + Get total value of skill from the armor and decorations based on + the number of slots. + decoration_values should be a list of points from the given number of slots, e.g. [1, 3] or [1, 3, 0] means that one slot gets 1 point and two slots get 3 points, [1, 0, 4] means that @@ -331,6 +334,14 @@ class Skill(RowModel): _indexes = { "skill_tree_id": ["id", "required_skill_tree_points", "name", "description"] } + def __init__(self, skill_row): + super(Skill, self).__init__(skill_row) + self.skill_tree = None + + def set_skill_tree(self, skill_tree): + assert skill_tree.id == self.skill_tree_id + self.skill_tree = skill_tree + class Weapon(ItemCraftable): _list_fields = ["id", "wtype", "name", "name_jp"] @@ -490,6 +501,13 @@ class MonsterDamage(ModelBase): def get_decoration_values(skill_id, decorations): + """ + Given a list of decorations that provide the specified skill_id, + figure out the best decoration for each number of slots from + one to three. Returns (id_list, value_list), where both are 3 element + arrays and id_list contains the decoration ids, and value_list contains + the number of skill points provided by each. + """ # TODO: write script to compute this and shove into skill_tree table values = [0, 0, 0] ids = [None, None, None]