fix: equipment field is category (not type), re-fetched data
This commit is contained in:
parent
f6858e6ea1
commit
0327a088f1
4 changed files with 261 additions and 206 deletions
|
|
@ -222,7 +222,7 @@ def filter_items(items: list, params: dict) -> list:
|
|||
if key == "name":
|
||||
result = [i for i in result if value.lower() in i.get("name", "").lower()]
|
||||
elif key == "type":
|
||||
result = [i for i in result if value.lower() in i.get("type", "").lower()]
|
||||
result = [i for i in result if value.lower() in i.get("type", "").lower() or value.lower() in i.get("category", "").lower()]
|
||||
elif key == "rarity":
|
||||
result = [i for i in result if value.lower() in i.get("rarity", "").lower()]
|
||||
elif key == "search":
|
||||
|
|
|
|||
|
|
@ -193,5 +193,59 @@
|
|||
"spellcasting_ability": null,
|
||||
"subclasses": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"_index": {
|
||||
"by_key": {
|
||||
"srd-2024_barbarian": true,
|
||||
"srd-2024_bard": true,
|
||||
"srd-2024_champion": true,
|
||||
"srd-2024_circle-of-the-land": true,
|
||||
"srd-2024_cleric": true,
|
||||
"srd-2024_college-of-lore": true,
|
||||
"srd-2024_draconic-sorcery": true,
|
||||
"srd-2024_druid": true,
|
||||
"srd-2024_evoker": true,
|
||||
"srd-2024_fiend-patron": true,
|
||||
"srd-2024_fighter": true,
|
||||
"srd-2024_hunter": true,
|
||||
"srd-2024_life-domain": true,
|
||||
"srd-2024_monk": true,
|
||||
"srd-2024_oath-of-devotion": true,
|
||||
"srd-2024_paladin": true,
|
||||
"srd-2024_path-of-the-berserker": true,
|
||||
"srd-2024_ranger": true,
|
||||
"srd-2024_rogue": true,
|
||||
"srd-2024_sorcerer": true,
|
||||
"srd-2024_thief": true,
|
||||
"srd-2024_warlock": true,
|
||||
"srd-2024_warrior-of-the-open-hand": true,
|
||||
"srd-2024_wizard": true
|
||||
},
|
||||
"by_name": {
|
||||
"barbarian": "srd-2024_barbarian",
|
||||
"bard": "srd-2024_bard",
|
||||
"champion": "srd-2024_champion",
|
||||
"circle of the land": "srd-2024_circle-of-the-land",
|
||||
"cleric": "srd-2024_cleric",
|
||||
"college of lore": "srd-2024_college-of-lore",
|
||||
"draconic sorcery": "srd-2024_draconic-sorcery",
|
||||
"druid": "srd-2024_druid",
|
||||
"evoker": "srd-2024_evoker",
|
||||
"fiend patron": "srd-2024_fiend-patron",
|
||||
"fighter": "srd-2024_fighter",
|
||||
"hunter": "srd-2024_hunter",
|
||||
"life domain": "srd-2024_life-domain",
|
||||
"monk": "srd-2024_monk",
|
||||
"oath of devotion": "srd-2024_oath-of-devotion",
|
||||
"paladin": "srd-2024_paladin",
|
||||
"path of the berserker": "srd-2024_path-of-the-berserker",
|
||||
"ranger": "srd-2024_ranger",
|
||||
"rogue": "srd-2024_rogue",
|
||||
"sorcerer": "srd-2024_sorcerer",
|
||||
"thief": "srd-2024_thief",
|
||||
"warlock": "srd-2024_warlock",
|
||||
"warrior of the open hand": "srd-2024_warrior-of-the-open-hand",
|
||||
"wizard": "srd-2024_wizard"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -142,10 +142,11 @@ def simplify_magic_item(m: dict) -> dict:
|
|||
|
||||
def simplify_item(i: dict) -> dict:
|
||||
"""Extract key fields from equipment/item."""
|
||||
cat = i.get("category") or {}
|
||||
return {
|
||||
"key": i.get("key", ""),
|
||||
"name": i.get("name", ""),
|
||||
"type": i.get("type", {}).get("name") if isinstance(i.get("type"), dict) else i.get("type"),
|
||||
"category": cat.get("name") if isinstance(cat, dict) else cat,
|
||||
"cost": i.get("cost", ""),
|
||||
"weight": i.get("weight", ""),
|
||||
"description": i.get("desc", ""),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue