Skip to content

Commit

Permalink
fix DB generation errors + mp5 regex
Browse files Browse the repository at this point in the history
  • Loading branch information
kayla-glick committed Mar 23, 2024
1 parent 7080047 commit 37e450b
Show file tree
Hide file tree
Showing 7 changed files with 535 additions and 519 deletions.
Binary file modified assets/database/db.bin
Binary file not shown.
985 changes: 495 additions & 490 deletions assets/database/db.json

Large diffs are not rendered by default.

Binary file modified assets/database/leftover_db.bin
Binary file not shown.
18 changes: 9 additions & 9 deletions assets/database/leftover_db.json

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,17 @@ func (rot *APLRotation) getStats() *proto.APLStats {

// Returns all action objects as an unstructured list. Used for easily finding specific actions.
func (rot *APLRotation) allAPLActions() []*APLAction {
return Flatten(MapSlice(rot.priorityList, func(action *APLAction) []*APLAction { return action.GetAllActions() }))
if rot == nil || rot.priorityList == nil {
return []*APLAction{}
}

return Flatten(MapSlice(rot.priorityList, func(action *APLAction) []*APLAction {
// Check if action is nil before calling GetAllActions
if action == nil {
return []*APLAction{}
}
return action.GetAllActions()
}))
}

// Returns all action objects from the prepull as an unstructured list. Used for easily finding specific actions.
Expand Down
36 changes: 18 additions & 18 deletions tools/database/gen_db/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,98 +458,98 @@ func GetAllRotationSpellIds() map[string][]int32 {
Class: proto.Class_ClassDruid,
Equipment: &proto.EquipmentSpec{},
TalentsString: "5102233115331303213305311031--205003002",
}, &proto.Player_BalanceDruid{BalanceDruid: &proto.BalanceDruid{Options: &proto.BalanceDruid_Options{}, Rotation: &proto.BalanceDruid_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_BalanceDruid{BalanceDruid: &proto.BalanceDruid{Options: &proto.BalanceDruid_Options{}}}), nil, nil, nil)},
{Name: "guardian", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassDruid,
Equipment: &proto.EquipmentSpec{},
TalentsString: "-503232132322010353120300313511-20350001",
}, &proto.Player_FeralTankDruid{FeralTankDruid: &proto.FeralTankDruid{Options: &proto.FeralTankDruid_Options{}, Rotation: &proto.FeralTankDruid_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_FeralTankDruid{FeralTankDruid: &proto.FeralTankDruid{Options: &proto.FeralTankDruid_Options{}}}), nil, nil, nil)},
{Name: "restodruid", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassDruid,
Equipment: &proto.EquipmentSpec{},
TalentsString: "05320031103--230023312131502331050313051",
}, &proto.Player_RestorationDruid{RestorationDruid: &proto.RestorationDruid{Options: &proto.RestorationDruid_Options{}, Rotation: &proto.RestorationDruid_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_RestorationDruid{RestorationDruid: &proto.RestorationDruid{Options: &proto.RestorationDruid_Options{}}}), nil, nil, nil)},
{Name: "elemental", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassShaman,
Race: proto.Race_RaceTroll,
Equipment: &proto.EquipmentSpec{},
TalentsString: "0532001523212351322301351-005052031",
}, &proto.Player_ElementalShaman{ElementalShaman: &proto.ElementalShaman{Options: &proto.ElementalShaman_Options{}, Rotation: &proto.ElementalShaman_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_ElementalShaman{ElementalShaman: &proto.ElementalShaman{Options: &proto.ElementalShaman_Options{}}}), nil, nil, nil)},
{Name: "enhance", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassShaman,
Race: proto.Race_RaceTroll,
Equipment: &proto.EquipmentSpec{},
TalentsString: "053030152-30405003105021333031131031051",
}, &proto.Player_EnhancementShaman{EnhancementShaman: &proto.EnhancementShaman{Options: &proto.EnhancementShaman_Options{}, Rotation: &proto.EnhancementShaman_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_EnhancementShaman{EnhancementShaman: &proto.EnhancementShaman{Options: &proto.EnhancementShaman_Options{}}}), nil, nil, nil)},
{Name: "restosham", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassShaman,
Race: proto.Race_RaceTroll,
Equipment: &proto.EquipmentSpec{},
TalentsString: "-3020503-50005331335310501122331251",
}, &proto.Player_RestorationShaman{RestorationShaman: &proto.RestorationShaman{Options: &proto.RestorationShaman_Options{}, Rotation: &proto.RestorationShaman_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_RestorationShaman{RestorationShaman: &proto.RestorationShaman{Options: &proto.RestorationShaman_Options{}}}), nil, nil, nil)},
{Name: "hunter", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassHunter,
Race: proto.Race_RaceTroll,
Equipment: &proto.EquipmentSpec{},
TalentsString: "-015305101-5000032500033330532135301311",
}, &proto.Player_Hunter{Hunter: &proto.Hunter{Options: &proto.Hunter_Options{}, Rotation: &proto.Hunter_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_Hunter{Hunter: &proto.Hunter{Options: &proto.Hunter_Options{}}}), nil, nil, nil)},
{Name: "mage", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassMage,
Race: proto.Race_RaceTroll,
Equipment: &proto.EquipmentSpec{},
TalentsString: "23000513310033015032310250532-03-023303001",
}, &proto.Player_Mage{Mage: &proto.Mage{Options: &proto.Mage_Options{}, Rotation: &proto.Mage_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_Mage{Mage: &proto.Mage{Options: &proto.Mage_Options{}}}), nil, nil, nil)},
{Name: "healingpriest", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassPriest,
Equipment: &proto.EquipmentSpec{},
TalentsString: "0503203130300512301313231251-2351010303",
}, &proto.Player_HealingPriest{HealingPriest: &proto.HealingPriest{Options: &proto.HealingPriest_Options{}, Rotation: &proto.HealingPriest_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_HealingPriest{HealingPriest: &proto.HealingPriest{Options: &proto.HealingPriest_Options{}}}), nil, nil, nil)},
{Name: "shadow", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassPriest,
Equipment: &proto.EquipmentSpec{},
TalentsString: "05032031--325023051223010323151301351",
}, &proto.Player_ShadowPriest{ShadowPriest: &proto.ShadowPriest{Options: &proto.ShadowPriest_Options{}, Rotation: &proto.ShadowPriest_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_ShadowPriest{ShadowPriest: &proto.ShadowPriest{Options: &proto.ShadowPriest_Options{}}}), nil, nil, nil)},
{Name: "rogue", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassRogue,
Equipment: &proto.EquipmentSpec{},
TalentsString: "00532000523-0252051050035010223100501251",
}, &proto.Player_Rogue{Rogue: &proto.Rogue{Options: &proto.Rogue_Options{}, Rotation: &proto.Rogue_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_Rogue{Rogue: &proto.Rogue{Options: &proto.Rogue_Options{}}}), nil, nil, nil)},
{Name: "warrior", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassWarrior,
Equipment: &proto.EquipmentSpec{},
TalentsString: "302023102331-305053000520310053120500351",
}, &proto.Player_Warrior{Warrior: &proto.Warrior{Options: &proto.Warrior_Options{}, Rotation: &proto.Warrior_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_Warrior{Warrior: &proto.Warrior{Options: &proto.Warrior_Options{}}}), nil, nil, nil)},
{Name: "protwarrior", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassWarrior,
Equipment: &proto.EquipmentSpec{},
TalentsString: "2500030023-302-053351225000012521030113321",
}, &proto.Player_ProtectionWarrior{ProtectionWarrior: &proto.ProtectionWarrior{Options: &proto.ProtectionWarrior_Options{}, Rotation: &proto.ProtectionWarrior_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_ProtectionWarrior{ProtectionWarrior: &proto.ProtectionWarrior{Options: &proto.ProtectionWarrior_Options{}}}), nil, nil, nil)},
{Name: "holypally", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassPaladin,
Equipment: &proto.EquipmentSpec{},
TalentsString: "50350151020013053100515221-50023131203",
}, &proto.Player_HolyPaladin{HolyPaladin: &proto.HolyPaladin{Options: &proto.HolyPaladin_Options{}, Rotation: &proto.HolyPaladin_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_HolyPaladin{HolyPaladin: &proto.HolyPaladin{Options: &proto.HolyPaladin_Options{}}}), nil, nil, nil)},
{Name: "protpally", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassPaladin,
Equipment: &proto.EquipmentSpec{},
TalentsString: "-05005135200132311333312321-511302012003",
}, &proto.Player_ProtectionPaladin{ProtectionPaladin: &proto.ProtectionPaladin{Options: &proto.ProtectionPaladin_Options{}, Rotation: &proto.ProtectionPaladin_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_ProtectionPaladin{ProtectionPaladin: &proto.ProtectionPaladin{Options: &proto.ProtectionPaladin_Options{}}}), nil, nil, nil)},
{Name: "ret", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassPaladin,
Race: proto.Race_RaceBloodElf,
Equipment: &proto.EquipmentSpec{},
TalentsString: "050501-05-05232051203331302133231331",
}, &proto.Player_RetributionPaladin{RetributionPaladin: &proto.RetributionPaladin{Options: &proto.RetributionPaladin_Options{}, Rotation: &proto.RetributionPaladin_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_RetributionPaladin{RetributionPaladin: &proto.RetributionPaladin{Options: &proto.RetributionPaladin_Options{}}}), nil, nil, nil)},
{Name: "warlock", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassWarlock,
Equipment: &proto.EquipmentSpec{},
TalentsString: "2350002030023510253500331151--550000051",
}, &proto.Player_Warlock{Warlock: &proto.Warlock{Options: &proto.Warlock_Options{}, Rotation: &proto.Warlock_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_Warlock{Warlock: &proto.Warlock{Options: &proto.Warlock_Options{}}}), nil, nil, nil)},
{Name: "dk", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassDeathknight,
Equipment: &proto.EquipmentSpec{},
TalentsString: "-320043500002-2300303050032152000150013133051",
}, &proto.Player_Deathknight{Deathknight: &proto.Deathknight{Options: &proto.Deathknight_Options{}, Rotation: &proto.Deathknight_Rotation{}}}), nil, nil, nil)},
}, &proto.Player_Deathknight{Deathknight: &proto.Deathknight{Options: &proto.Deathknight_Options{}}}), nil, nil, nil)},
{Name: "tankdk", Raid: core.SinglePlayerRaidProto(core.WithSpec(&proto.Player{
Class: proto.Class_ClassDeathknight,
Equipment: &proto.EquipmentSpec{},
Expand Down
3 changes: 2 additions & 1 deletion tools/database/wowhead_tooltips.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ var hasteRegex = regexp.MustCompile(`Improves haste rating by <!--rtg36-->([0-9]

var spellPenetrationRegex = regexp.MustCompile(`Increases your spell penetration by ([0-9]+)\.`)
var mp5Regex = regexp.MustCompile(`Restores ([0-9]+) mana per 5 sec\.`)
var mp5Regex2 = regexp.MustCompile(`Restores <!--rtg43-->([0-9]+) mana per 5 sec\.`)
var attackPowerRegex = regexp.MustCompile(`Increases attack power by ([0-9]+)\.`)
var attackPowerRegex2 = regexp.MustCompile(`Increases attack power by <!--rtg38-->([0-9]+)\.`)

Expand Down Expand Up @@ -229,7 +230,7 @@ func (item WowheadItemResponse) GetStats() Stats {
proto.Stat_StatSpellHaste: float64(item.GetIntValue(hasteRegex)),
proto.Stat_StatMeleeHaste: float64(item.GetIntValue(hasteRegex)),
proto.Stat_StatSpellPenetration: float64(item.GetIntValue(spellPenetrationRegex)),
proto.Stat_StatMP5: float64(item.GetIntValue(mp5Regex)),
proto.Stat_StatMP5: float64(item.GetIntValue(mp5Regex)) + float64(item.GetIntValue(mp5Regex2)),
proto.Stat_StatAttackPower: baseAP,
proto.Stat_StatRangedAttackPower: baseAP + float64(item.GetIntValue(rangedAttackPowerRegex)) + float64(item.GetIntValue(rangedAttackPowerRegex2)),
proto.Stat_StatArmorPenetration: float64(item.GetIntValue(armorPenetrationRegex) + item.GetIntValue(armorPenetrationRegex2)),
Expand Down

0 comments on commit 37e450b

Please sign in to comment.