From 0775875cc42ca4243bfb9b95e15a4a75beba5548 Mon Sep 17 00:00:00 2001 From: Joseph Keen Date: Mon, 17 Oct 2022 09:09:57 -0600 Subject: [PATCH 1/6] Add handling for TftYP entitlements in the workshop Due to the modular nature of this book, it was broken into 7 different sources and only those were given out. This checks if you have access to all 7 'modules', and grants the TftYP entitlement if you do. --- ddb/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ddb/client.py b/ddb/client.py index 83cf73d1b..8a8c6c357 100644 --- a/ddb/client.py +++ b/ddb/client.py @@ -93,6 +93,11 @@ async def get_accessible_entities(self, ctx, user_id, entity_type): if entity.is_free or user_licenses & entity.license_ids: accessible.add(entity.entity_id) + # source 14 is TftYP, and 16-22 are the modules within. + # DDB only gives entitlements for the modules + if entity_type == "source" and {16, 17, 18, 19, 20, 21, 22}.issubset(user_licenses): + accessible.add(14) + log.debug(f"Discord user {user_id} can see {entity_type}s {accessible}") return accessible From 2f5070d8e5323cc2eb87a699c24c3615b7925745 Mon Sep 17 00:00:00 2001 From: Joseph Keen Date: Mon, 17 Oct 2022 09:12:27 -0600 Subject: [PATCH 2/6] Add an `AliasSpellbook.get(spellname)` method to get a specific spell from the spellbook --- aliasing/api/statblock.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aliasing/api/statblock.py b/aliasing/api/statblock.py index 56244a0eb..87e66d6e8 100644 --- a/aliasing/api/statblock.py +++ b/aliasing/api/statblock.py @@ -697,6 +697,7 @@ def __init__(self, spellbook): """ self._spellbook = spellbook self._spells = None + self._spell_dict = None @property def dc(self): @@ -782,6 +783,19 @@ def max_pact_slots(self): """ return self._spellbook.max_pact_slots + def get(self, spell_name: str): + """ + Returns the spell of the given name, case-insensitive, if it's in the spellbook, or None if it is not. + + :rtype: AliasSpellbookSpell or None + """ + if self._spell_dict is None: + if self._spells is None: + self._spells = [AliasSpellbookSpell(s) for s in self._spellbook.spells] + self._spell_dict = {spell.name.lower(): spell for spell in self._spells} + + return self._spell_dict.get(spell_name.lower()) + def slots_str(self, level): """ :param int level: The level of spell slot to return. From 4a20d6a356e3a028f2958fdcb61423dc2ff46243 Mon Sep 17 00:00:00 2001 From: Joseph Keen Date: Mon, 17 Oct 2022 09:55:34 -0600 Subject: [PATCH 3/6] Updating phrasing on `!help embed` or inline fields Resolves #1866 --- cogs5e/pbpUtils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs5e/pbpUtils.py b/cogs5e/pbpUtils.py index 144375636..542e66aac 100644 --- a/cogs5e/pbpUtils.py +++ b/cogs5e/pbpUtils.py @@ -43,7 +43,7 @@ async def embed(self, ctx, *, args): -image -footer