Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Phase Filtering and Individual Raid Filter Options #35

Merged
merged 4 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/database/db.bin
Binary file not shown.
3,317 changes: 1,666 additions & 1,651 deletions assets/database/db.json

Large diffs are not rendered by default.

Binary file modified assets/database/leftover_db.bin
Binary file not shown.
27 changes: 3 additions & 24 deletions assets/database/leftover_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1406,35 +1406,14 @@
{"id":22280,"name":"Lovely Purple Dress","icon":"inv_chest_cloth_17","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"sources":[{"quest":{"id":9029,"name":"A Bubbling Cauldron"}}]},
{"id":22281,"name":"Blue Dinner Suit","icon":"inv_shirt_blue_01","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"sources":[{"quest":{"id":9029,"name":"A Bubbling Cauldron"}}]},
{"id":22282,"name":"Purple Dinner Suit","icon":"inv_shirt_purple_01","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"sources":[{"quest":{"id":9029,"name":"A Bubbling Cauldron"}}]},
{"id":22679,"phase":6},
{"id":22742,"name":"Bloodsail Shirt","icon":"inv_shirt_08","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"sources":[{"drop":{"npcId":22746}},{"rep":{"repFactionId":87,"repLevel":5}}]},
{"id":22744,"name":"Bloodsail Boots","icon":"inv_boots_05","type":10,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"sources":[{"drop":{"npcId":22746}}]},
{"id":22745,"name":"Bloodsail Pants","icon":"inv_pants_cloth_02","type":9,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"sources":[{"drop":{"npcId":22746}},{"rep":{"repFactionId":87,"repLevel":5}}]},
{"id":23323,"name":"Crown of the Fire Festival","icon":"inv_helmet_08","type":1,"armorType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1},
{"id":23324,"name":"Mantle of the Fire Festival","icon":"inv_shoulder_23","type":3,"armorType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"sources":[{"quest":{"id":9323,"name":"Wild Fires in the Eastern Kingdoms"}}]},
{"id":23714,"name":"Perpetual Purple Firework","icon":"inv_misc_missilesmall_purple","type":12,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":20,"phase":1,"quality":1},
{"id":23716,"name":"Carved Ogre Idol","icon":"inv_misc_idol_01","type":12,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"unique":true},
{"id":213343,"sources":[{"quest":{"id":80324,"name":"The Mad King"}},{"quest":{"id":80325,"name":"The Mad King"}}]},
{"id":213344,"sources":[{"quest":{"id":80324,"name":"The Mad King"}},{"quest":{"id":80325,"name":"The Mad King"}}]},
{"id":213345,"sources":[{"quest":{"id":80324,"name":"The Mad King"}},{"quest":{"id":80325,"name":"The Mad King"}}]},
{"id":213346,"sources":[{"quest":{"id":80324,"name":"The Mad King"}},{"quest":{"id":80325,"name":"The Mad King"}}]},
{"id":217245,"sources":[{"crafted":{"profession":11,"spellId":439085}}]},
{"id":217246,"sources":[{"crafted":{"profession":11,"spellId":439086}}]},
{"id":217252,"sources":[{"crafted":{"profession":11,"spellId":439094}}]},
{"id":217257,"sources":[{"crafted":{"profession":11,"spellId":439102}}]},
{"id":217259,"sources":[{"crafted":{"profession":8,"spellId":439105}}]},
{"id":217261,"sources":[{"crafted":{"profession":8,"spellId":439108}}]},
{"id":217268,"sources":[{"crafted":{"profession":8,"spellId":439116}}]},
{"id":217270,"sources":[{"crafted":{"profession":8,"spellId":439118}}]},
{"id":217277,"sources":[{"crafted":{"profession":2,"spellId":439124}}]},
{"id":217279,"sources":[{"crafted":{"profession":2,"spellId":439126}}]},
{"id":217285,"sources":[{"crafted":{"profession":2,"spellId":439132}}]},
{"id":220626,"sources":[{"quest":{"id":82081,"name":"A Broken Ritual"}},{"quest":{"id":82083,"name":"A Broken Ritual"}}]},
{"id":220627,"sources":[{"quest":{"id":82081,"name":"A Broken Ritual"}},{"quest":{"id":82083,"name":"A Broken Ritual"}}]},
{"id":220628,"sources":[{"quest":{"id":82081,"name":"A Broken Ritual"}},{"quest":{"id":82083,"name":"A Broken Ritual"}}]},
{"id":220629,"sources":[{"quest":{"id":82081,"name":"A Broken Ritual"}},{"quest":{"id":82083,"name":"A Broken Ritual"}}]},
{"id":220630,"sources":[{"quest":{"id":82081,"name":"A Broken Ritual"}},{"quest":{"id":82083,"name":"A Broken Ritual"}}]},
{"id":221457,"rangedWeaponType":5},
{"id":221464,"rangedWeaponType":7}
{"id":23716,"name":"Carved Ogre Idol","icon":"inv_misc_idol_01","type":12,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"weaponSkills":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ilvl":1,"phase":1,"quality":1,"unique":true}
],
"randomSuffixes":[
],
Expand All @@ -1456,8 +1435,8 @@
{"effectId":63,"spellId":13538,"name":"Enchant Chest - Lesser Absorption","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":66,"spellId":7457,"name":"Enchant Bracer - Minor Stamina","type":6,"stats":[0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":66,"spellId":7863,"name":"Enchant Boots - Minor Stamina","type":10,"stats":[0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":241,"spellId":7745,"name":"Enchant 2H Weapon - Minor Impact","type":13,"enchantType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":241,"spellId":13503,"name":"Enchant Weapon - Lesser Striking","type":13,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":241,"spellId":7745,"name":"Enchant 2H Weapon - Minor Impact","type":13,"enchantType":1,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":242,"spellId":7748,"name":"Enchant Chest - Lesser Health","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0],"quality":1},
{"effectId":243,"spellId":7766,"name":"Enchant Bracer - Minor Spirit","type":6,"stats":[0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":2},
{"effectId":246,"spellId":7776,"name":"Enchant Chest - Lesser Mana","type":5,"stats":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"quality":2},
Expand Down
13 changes: 3 additions & 10 deletions proto/ui.proto
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,11 @@ enum DungeonFilterOption {
}

enum RaidFilterOption {
RaidUnknown = 0;
RaidBlackfathomDeeps = 719;
RaidGnomeregan = 721;
RaidSunkenTemple = 1477;
RaidUnknown = 0;
RaidMoltenCore = 2717;
RaidOnyxiasLair = 2159;
RaidBlackwingLair = 2677;
RaidZulGurub = 1977;
RaidZulGurub = 1977;
RaidRuinsOfAQ = 3428;
RaidTempleOfAQ = 3429;
RaidNaxxramas = 3456;
Expand All @@ -235,11 +233,6 @@ enum RaidFilterOption {
// Zones not yet available to players
enum ExcludedZones {
ZoneUnknown = 0;
// ZoneZulGurub = 1977;
// ZoneBlackwingLair = 2677;
// ZoneRuinsOfAQ = 3428;
// ZoneTempleOfAQ = 3429;
ZoneNaxxramas = 3456;
}

// Next tag: 23
Expand Down
269 changes: 269 additions & 0 deletions tools/database/gen_db/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"slices"
"strconv"
"strings"

"github.com/wowsims/classic/sim"
"github.com/wowsims/classic/sim/core"
Expand Down Expand Up @@ -197,6 +198,18 @@ func main() {
db.RandomSuffixes[randomSuffixID] = wowheadDB.RandomSuffixes[strconv.Itoa(int(randomSuffixID))].ToProto()
}
}

// Populate phase data
if item.Phase == 1 {
item.Phase = GetPhaseData(item)
}

// Tier and Dungeon 2 Set items don't all have class restrictions
// Let's pretend that they do for UI filtering
// Note: Dungeon 2 sets don't have quest source data, so we can't check Quest source here
if item.SetId > 0 && len(item.ClassAllowlist) == 0 {
item.ClassAllowlist = GetClassAllowList(item)
}
}

for _, spellId := range database.SharedSpellsIcons {
Expand Down Expand Up @@ -509,3 +522,259 @@ func GetAllRotationSpellIds() map[string][]int32 {

return ret_db
}

func GetPhaseData(item *proto.UIItem) int32 {
for _, itemSource := range item.Sources {
dropSource := itemSource.GetDrop()
if dropSource != nil {
// Zone IDs as defined by WoWHead - does NOT match the in-game Zone ID!
// P1 - Molten Core, Ony
if slices.Contains([]int32{2717, 2159}, dropSource.ZoneId) {
return 1
}

// P2 - Dire Maul
if dropSource.ZoneId == 2557 {
return 2
}

// P3 - BWL
if dropSource.ZoneId == 2677 {
return 3
}

// P4 - ZG
if dropSource.ZoneId == 1977 {
return 4
}

// P5 - AQ 20/40
if slices.Contains([]int32{3428, 3429}, dropSource.ZoneId) {
return 5
}

// P6 - Naxx
if dropSource.ZoneId == 3456 {
return 6
}

// Nightmare Dragons
if slices.Contains([]int32{14889, 14888, 14890, 14887}, dropSource.NpcId) {
return 4
}

// Kazzak and Azuregos
if slices.Contains([]int32{12397, 6109}, dropSource.NpcId) {
return 2
}

// Silithus Lord/Abyssal Summons
if slices.Contains([]int32{
15204, 15305, 15203, 15205,
15207, 15206, 15208, 15220,
15211, 15209, 15307, 15212,
}, dropSource.NpcId) {
return 5
}
}

// Vendor Items
vendorSource := itemSource.GetSoldBy()
if vendorSource != nil {
// PvP Rank gear. Phase determined by item quality (Rare/Epic)
if slices.Contains([]int32{14581, 12782, 12792, 12777}, vendorSource.NpcId) {
if item.Quality == proto.ItemQuality_ItemQualityEpic {
return 5
} else {
return 2
}
}
}

// Quest Source
// Tier is easier to filter on Item Set IDs, do not place those here
questSource := itemSource.GetQuest()
if questSource != nil {
// DM quest rewards
if slices.Contains(([]int32{7506, 7503, 7500, 7501, 7504, 7498, 7505, 7502, 7499}), questSource.Id) {
return 2
}

// Nef Head
// Darkmoon Decks and Necks
if slices.Contains([]int32{7782, 7784, 7927, 7929, 7907, 7928, 7981, 7940}, questSource.Id) {
return 3
}

// ZG Belt Quest
if questSource.Id == 8201 {
return 4
}

// Various AQ Quests
// Scepter Quest Rewards
// "Path of the X"
// Silithus Battlegear
// Cthun Head
// Ossirian Head
// The Perfect Poison
// Armaments of War
if slices.Contains([]int32{
8730, 8745, 8736,
8752, 8757, 8747,
8572, 8573, 8548, 8574,
8802,
8791,
9023,
8316, 8376, 8377, 8379, 8380, 8381, 8382, 8378,
}, questSource.Id) {
return 5
}

// KT Phylactery Trinkets
// Armaments Argent Dawn rewards
if slices.Contains([]int32{9120,
9228, 9227, 9224, 9225, 9222, 9221, 9223, 9226,
}, questSource.Id) {
return 6
}
}

// Reputation items
repSource := itemSource.GetRep()
if repSource != nil {
// WSG/AV
if slices.Contains([]int32{729, 730, 889, 890}, repSource.RepFactionId) {
return 2
}

// AB
if slices.Contains([]int32{510, 509}, repSource.RepFactionId) {
return 4
}

// Brood of Nozdorumu
if repSource.RepFactionId == 910 {
return 5
}
}
}

/// TIER AND OTHER SETS

// Dungeon 2
if slices.Contains([]int32{512, 516, 515, 514, 513, 518, 511, 517, 519}, item.SetId) {
return 5
}

// ZG Class+Crafted Sets
if slices.Contains([]int32{478, 474, 475, 479, 481, 480, 477, 476, 482, 421, 441, 443, 444}, item.SetId) {
return 4
}

// ZG Bloodvine Lens/Goggles
// Not in any set, have to filter by Item ID
if slices.Contains([]int32{19998, 19999}, item.Id) {
return 4
}

// T2.5 and AQ20
if slices.Contains([]int32{498, 500, 494, 510, 502, 495, 506, 504, 508,
496, 505, 493, 501, 499, 503, 497, 509, 507}, item.SetId) {
return 5
}

// AQ Raid Quest Items
if strings.Contains(item.Name, "Blessed Qiraji") {
return 5
}

// T3
if slices.Contains([]int32{523, 524, 529, 526, 528, 521, 530, 525, 527}, item.SetId) {
return 6
}

/// NAME MATCHING

// Thunderfury
// Quel'Serrar
// AV Rep Trinkets
if strings.Contains(item.Name, "Thunderfury") ||
strings.Contains(item.Name, "Quel'Serrar") ||
strings.Contains(item.Name, "Frostwolf Insignia") ||
strings.Contains(item.Name, "Stormpike Insignia") {
return 2
}

// ZG Necks
if strings.Contains(item.Name, "Zandalarian") {
return 4
}

// Atiesh
if strings.Contains(item.Name, "Atiesh") {
return 6
}

// Naxx Frost Resist items
if (strings.Contains(item.Name, "Glacial") ||
strings.Contains(item.Name, "Polar") ||
strings.Contains(item.Name, "Icebane") ||
strings.Contains(item.Name, "Icy Scale")) &&
item.Quality == proto.ItemQuality_ItemQualityEpic {
return 6
}

return 1
}

func GetClassAllowList(item *proto.UIItem) []proto.Class {
// Filter on Dungeon2 and T3 set IDs that don't have an existing class flag

// Rogue
if slices.Contains([]int32{512, 524}, item.SetId) {
return []proto.Class{proto.Class_ClassRogue}
}

// Hunter
if slices.Contains([]int32{515, 530}, item.SetId) {
return []proto.Class{proto.Class_ClassHunter}
}

// Mage
if slices.Contains([]int32{517, 526}, item.SetId) {
return []proto.Class{proto.Class_ClassMage}
}

// Druid
if slices.Contains([]int32{513, 521}, item.SetId) {
return []proto.Class{proto.Class_ClassDruid}
}

// Warrior
if slices.Contains([]int32{523, 511}, item.SetId) {
return []proto.Class{proto.Class_ClassWarrior}
}

// Warlock
if slices.Contains([]int32{529, 518}, item.SetId) {
return []proto.Class{proto.Class_ClassWarlock}
}

// Paladin
if slices.Contains([]int32{528, 516}, item.SetId) {
return []proto.Class{proto.Class_ClassPaladin}
}

// Priest
if slices.Contains([]int32{525, 514}, item.SetId) {
return []proto.Class{proto.Class_ClassPriest}
}

// Shaman
if slices.Contains([]int32{527, 519}, item.SetId) {
return []proto.Class{proto.Class_ClassShaman}
}

return item.ClassAllowlist
}
Loading
Loading