Skip to content

Commit

Permalink
Make the proto setup less dumb
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBackstabi committed Dec 4, 2024
1 parent 9b36925 commit 9daeab9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
14 changes: 7 additions & 7 deletions proto/ui.proto
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ enum DungeonFilterOption {

enum RaidFilterOption {
RaidUnknown = 0;
RaidMoltenCore = 1;
RaidOnyxiasLair = 2;
RaidBlackwingLair = 3;
RaidZulGurub = 4;
RaidRuinsOfAQ = 5;
RaidTempleOfAQ = 6;
RaidNaxxramas = 7;
RaidMoltenCore = 2717;
RaidOnyxiasLair = 2159;
RaidBlackwingLair = 2677;
RaidZulGurub = 1977;
RaidRuinsOfAQ = 3428;
RaidTempleOfAQ = 3429;
RaidNaxxramas = 3456;
}

// Zones not yet available to players
Expand Down
16 changes: 3 additions & 13 deletions ui/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1111,16 +1111,6 @@ export class Player<SpecType extends Spec> {

static WEAPON_SLOTS: Array<ItemSlot> = [ItemSlot.ItemSlotMainHand, ItemSlot.ItemSlotOffHand];

static readonly RAID_IDS: Partial<Record<RaidFilterOption, number>> = {
[RaidFilterOption.RaidMoltenCore]: 2717,
[RaidFilterOption.RaidOnyxiasLair]: 2159,
[RaidFilterOption.RaidBlackwingLair]: 2677,
[RaidFilterOption.RaidZulGurub]: 1977,
[RaidFilterOption.RaidRuinsOfAQ]: 3428,
[RaidFilterOption.RaidTempleOfAQ]: 3429,
[RaidFilterOption.RaidNaxxramas]: 3456
}

filterItemData<T>(itemData: Array<T>, getItemFunc: (val: T) => Item, slot: ItemSlot): Array<T> {
const filters = this.sim.getFilters();

Expand Down Expand Up @@ -1167,9 +1157,9 @@ export class Player<SpecType extends Spec> {
}
}

for(const [raidOptionStr, zoneId] of Object.entries(Player.RAID_IDS)) {
const raidOption = parseInt(raidOptionStr) as RaidFilterOption
if (!filters.sources.includes(SourceFilterOption.SourceRaid) || !filters.raids.includes(raidOption)) {
for(const zoneName in RaidFilterOption) {
const zoneId = parseInt(RaidFilterOption[zoneName])
if (!filters.sources.includes(SourceFilterOption.SourceRaid) || !filters.raids.includes(zoneId)) {
itemData = filterItems(
itemData,
item => !item.sources.some(itemSrc => itemSrc.source.oneofKind == 'drop' && itemSrc.source.drop.zoneId == zoneId),
Expand Down

0 comments on commit 9daeab9

Please sign in to comment.