Repository navigation
feat(helpers): add get_omicron_breakdown for guild-wide omicron adoption - #265
Merged
Merged
Conversation
is_omicron_skill treated a tier of 0 as missing and raised, both for a roster_unit_skill and for a skill_tier passed directly. Tier 0 is the value a freshly unlocked skill carries, and a skill whose only tier is its omicron has the omicron at index 0, so only a missing tier is now an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summarise omicron adoption across a set of player profiles, grouped by game mode. Every omicron skill in game data becomes a row that splits the players into those who have applied it, those who own the unit but have not, and a count of those who do not own the unit. A skill is an omicron when one of its tiers is flagged isOmicronTier, never because of its omicronMode: mode 1 (ALL_OMICRON) is the value every skill without an omicron carries. The mode is read as a number whether the game data was fetched with enums=False or enums=True, including the type-prefixed spelling, through parse_enum and the OmicronMode members; a mode name the library does not know yet is kept as given. Labels default to OMICRON_MODE and can be overridden. Ownership is a property of the unit, resolved through the unit that can be in a roster. Many omicron skills are referenced by several base IDs, a playable unit plus a non-obtainable PVE_ mirror and sometimes an event variant, so playable units (get_playable_units, which also reads an enums=True rarity) claim their skills first. A skill missing from an owner's roster is star-gated, not evidence of non-ownership, and a listed skill without a tier is at tier 0. An optional ability_list names each omicron from the ability its skill references; a skill's own nameKey is a placeholder shared across unrelated skills, and a unit often has several omicrons in one mode. Unit and omicron names are localized through _localize. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a Sync and an Async guild_omicron_breakdown.py that report omicron adoption across a guild by game mode. Both list the members with get_guild_members(), fetch every member's profile (concurrently with asyncio.TaskGroup in the Async one), request only the skill, units and ability collections by combining DataItems bits with |, and print the top omicrons per mode followed by the members who own the unit behind the biggest unapplied omicron. List both in the examples READMEs, docs/examples.md and the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
get_omicron_breakdown(), which summarises omicron adoption across a set of player profiles, grouped by game mode. Every omicron skill in game data becomes a row that splits the players into three groups:This answers "who in the guild can still apply this omicron?" in one call.
How it decides
isOmicronTier, never because of itsomicronMode. Mode 1 (ALL_OMICRON) is the value every skill without an omicron carries.enums=Falseorenums=True, throughparse_enumand theOmicronModemembers. The bare and type-prefixed names both work. A mode name the library does not know yet is kept as sent. Labels default toOMICRON_MODEand can be overridden withmode_names.PVE_mirror and sometimes an event variant. Playable units (get_playable_units) claim their skills first, so owners are not reported as non-owners. A skill missing from an owner's roster is locked behind a star level, which is not evidence that they don't own the unit.ability_listnames each omicron from the ability its skill references. A skill's ownnameKeyis a placeholder shared across unrelated skills, and a unit often has several omicrons in one mode (Doctor Aphra has three in 5v5 Grand Arena). Unit and omicron names are localized when a localization dictionary is passed.Results are TypedDicts (
OmicronBreakdown,OmicronModeBreakdown,OmicronSkillStats,OmicronMember), like the other helper results.The separate
fix(helpers): accept tier 0 in is_omicron_skillcommitis_omicron_skill()treated a tier of0as missing and raised, both forroster_unit_skilland for askill_tierpassed directly.fixcommit gives it its own changelog entry, separate from the new feature.Examples
examples/Sync/guild_omicron_breakdown.pyandexamples/Async/guild_omicron_breakdown.pylist a guild's members withget_guild_members()and fetch every profile (concurrently withasyncio.TaskGroupin the Async one).skill,unitsandabilitycollections, by combiningDataItemsbits with|.docs/examples.mdand the README.Related Issues
None.
Type of Change
Checklist
developbranch (only release PRs targetmain)feat:,fix:,refactor:, etc.) — they become the changelogCHANGELOG.mdby hand (it is generated from commit messages)README.md,docs/,examples/) if user-facing behavior changeduv run pytest tests/)uv run ruff check src/ tests/anduv run ruff format --check src/ tests/)uv run ty check src/swgoh_comlink/)Testing
Automated
enums=Truenames, type-prefixed names, numeric strings, an unknown name, a missing mode, custom labels;PVE_mirrors and event variants, including anenums=Truerarity;uv run pytest tests/: 2033 passed, 31 skipped.uv run ruff checkanduv run ruff format --checkonsrc/ tests/ examples/ parity/,uv run ty check src/swgoh_comlink/,uv run python .github/scripts/unasync.py --checkanduv run mkdocs build --strictall pass.Live, against the public Comlink release (spec 0.40.5), read-only calls only
enums=Truegame data was identical to the one built fromenums=Falsegame data.🤖 Generated with Claude Code