diff --git a/mhapi/db.py b/mhapi/db.py index 7701306..b555a21 100644 --- a/mhapi/db.py +++ b/mhapi/db.py @@ -37,7 +37,8 @@ class MHDB(object): """ # buy and sell are empty, uses weapon.create_cost and upgrade_cost _weapon_select = """ - SELECT items._id, items.type, items.name, items.rarity, weapons.* + SELECT items._id, items.type, items.name, items.name_jp, + items.rarity, weapons.* FROM weapons LEFT JOIN items ON weapons._id = items._id """ @@ -310,7 +311,10 @@ class MHDB(object): """, (monster_id,), collection_cls=model.MonsterDamage) def get_weapons(self): - return self._query_all("weapons", MHDB._weapon_select, + # Note: weapons only available via JP DLC have no localized + # name, filter them out. + return self._query_all("weapons", MHDB._weapon_select + """ + WHERE items.name != items.name_jp""", model_cls=model.Weapon) def get_weapons_by_query(self, wtype=None, element=None, @@ -323,7 +327,7 @@ class MHDB(object): @final should be string '1' or '0' """ q = MHDB._weapon_select - where = [] + where = ["items.name != items.name_jp"] args = [] if wtype is not None: where.append("wtype = ?") diff --git a/mhapi/model.py b/mhapi/model.py index b9ff471..4038c22 100644 --- a/mhapi/model.py +++ b/mhapi/model.py @@ -357,6 +357,9 @@ class Weapon(ItemCraftable): self._data["sharpness"] = WeaponSharpness(normal) self._data["sharpness_plus"] = WeaponSharpness(plus) + def is_not_localized(self): + return (self.name == self.name_jp) + class Monster(RowModel): _list_fields = ["id", "class", "name"]