Avr 1020 monk ability version filtering#2204
Conversation
| version = "2024" # default | ||
| if hasattr(self, 'ctx') and self.ctx: | ||
| try: | ||
| if hasattr(self.ctx, 'get_server_settings'): | ||
| serv_settings = await self.ctx.get_server_settings() if self.ctx.guild else None | ||
| else: | ||
| from utils.settings.guild import ServerSettings | ||
| serv_settings = await ServerSettings.for_guild(mdb=self.ctx.bot.mdb, guild_id=self.ctx.guild.id) | ||
|
|
||
| if serv_settings: | ||
| version = serv_settings.version | ||
|
|
||
| if serv_settings and serv_settings.allow_character_override or not serv_settings: | ||
| try: | ||
| if hasattr(self.ctx, 'get_character'): | ||
| character = await self.ctx.get_character() | ||
| else: | ||
| from cogs5e.models.character import Character | ||
| character = await Character.from_ctx(self.ctx) | ||
|
|
||
| if character.options.version: | ||
| version = character.options.version | ||
| except: | ||
| pass | ||
| except: | ||
| pass | ||
|
|
There was a problem hiding this comment.
I see this code block repeated 4 times - could we pull this out into a function?
self.ctx is guaranteed to exist since this is a function call from self.load_character
also - I dislike the imports inside the function - it will re-import it every time.
|
also - it seems like your branch has merge conflicts at the moment. make sure your branch is synced with nightly. |
…ons to async, add version filtering for actions
…ering for action retrieval
…d update get_actions for version filtering
…lity function and update action retrieval methods to use it
75d328d to
28b159a
Compare
|
@1drturtle Good feedback, thank you - new changes pushed. Does the logic look sound aside from that? |
…sary hasattr checks
1drturtle
left a comment
There was a problem hiding this comment.
Looks good. Don't have dicecloud on local copy but Gsheet/ddb import successfully in server and DM. All tests pass.
|
|
||
| # don't bother parsing if a compendium action is found | ||
| if "avrae:parse_only" not in tags and (atk_actions := self.persist_actions_for_name(aname)): | ||
| if "avrae:parse_only" not in tags and (atk_actions := self.persist_actions_for_name(aname, "2024")): |
There was a problem hiding this comment.
This should be version here as well, correct? Instead of "2024".
Correct me if I'm wrong, I'm not fully familiar with this monk ability
tonip-wizard
left a comment
There was a problem hiding this comment.
Need to fix issue with dicecloud import
Summary
Fixes monk abilities randomly requiring "Ki Points" (D&D 2014) vs "Focus Points" (D&D 2024) due to action discovery not filtering by D&D rules version. Uses the server settings to decide instead of guessing.
Changelog Entry
Fix monk abilities version filtering for D&D 2014/2024 compatibility (AVR-1020)
PR Type
Breaking Change
Testing
Changes Made
Closes AVR-1020