Skip to content

Commit

Permalink
Generate db with reforge stats
Browse files Browse the repository at this point in the history
  • Loading branch information
ToxicKevinFerm committed Mar 1, 2024
1 parent 2c80556 commit bb7a2a4
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 40 deletions.
Binary file modified assets/database/db.bin
Binary file not shown.
63 changes: 63 additions & 0 deletions assets/database/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -9226,6 +9226,64 @@
{"id":38113,"name":"Marwyn","zoneId":4820},
{"id":38433,"name":"Toravon the Ice Watcher","zoneId":4603}
],
"reforgeStats":[
{"id":113,"fromStat":[4],"toStat":[25],"multiplier":0.4},
{"id":114,"fromStat":[4],"toStat":[26],"multiplier":0.4},
{"id":115,"fromStat":[4],"toStat":[12,7],"multiplier":0.4},
{"id":116,"fromStat":[4],"toStat":[13,8],"multiplier":0.4},
{"id":117,"fromStat":[4],"toStat":[14,9],"multiplier":0.4},
{"id":118,"fromStat":[4],"toStat":[16],"multiplier":0.4},
{"id":119,"fromStat":[4],"multiplier":0.4},
{"id":120,"fromStat":[25],"toStat":[4],"multiplier":0.4},
{"id":121,"fromStat":[25],"toStat":[26],"multiplier":0.4},
{"id":122,"fromStat":[25],"toStat":[12,7],"multiplier":0.4},
{"id":123,"fromStat":[25],"toStat":[13,8],"multiplier":0.4},
{"id":124,"fromStat":[25],"toStat":[14,9],"multiplier":0.4},
{"id":125,"fromStat":[25],"toStat":[16],"multiplier":0.4},
{"id":126,"fromStat":[25],"multiplier":0.4},
{"id":127,"fromStat":[26],"toStat":[4],"multiplier":0.4},
{"id":128,"fromStat":[26],"toStat":[25],"multiplier":0.4},
{"id":129,"fromStat":[26],"toStat":[12,7],"multiplier":0.4},
{"id":130,"fromStat":[26],"toStat":[13,8],"multiplier":0.4},
{"id":131,"fromStat":[26],"toStat":[14,9],"multiplier":0.4},
{"id":132,"fromStat":[26],"toStat":[16],"multiplier":0.4},
{"id":133,"fromStat":[26],"multiplier":0.4},
{"id":134,"fromStat":[12,7],"toStat":[4],"multiplier":0.4},
{"id":135,"fromStat":[12,7],"toStat":[25],"multiplier":0.4},
{"id":136,"fromStat":[12,7],"toStat":[26],"multiplier":0.4},
{"id":137,"fromStat":[12,7],"toStat":[13,8],"multiplier":0.4},
{"id":138,"fromStat":[12,7],"toStat":[14,9],"multiplier":0.4},
{"id":139,"fromStat":[12,7],"toStat":[16],"multiplier":0.4},
{"id":140,"fromStat":[12,7],"multiplier":0.4},
{"id":141,"fromStat":[13,8],"toStat":[4],"multiplier":0.4},
{"id":142,"fromStat":[13,8],"toStat":[25],"multiplier":0.4},
{"id":143,"fromStat":[13,8],"toStat":[26],"multiplier":0.4},
{"id":144,"fromStat":[13,8],"toStat":[12,7],"multiplier":0.4},
{"id":145,"fromStat":[13,8],"toStat":[14,9],"multiplier":0.4},
{"id":146,"fromStat":[13,8],"toStat":[16],"multiplier":0.4},
{"id":147,"fromStat":[13,8],"multiplier":0.4},
{"id":148,"fromStat":[14,9],"toStat":[4],"multiplier":0.4},
{"id":149,"fromStat":[14,9],"toStat":[25],"multiplier":0.4},
{"id":150,"fromStat":[14,9],"toStat":[26],"multiplier":0.4},
{"id":151,"fromStat":[14,9],"toStat":[12,7],"multiplier":0.4},
{"id":152,"fromStat":[14,9],"toStat":[13,8],"multiplier":0.4},
{"id":153,"fromStat":[14,9],"toStat":[16],"multiplier":0.4},
{"id":154,"fromStat":[14,9],"multiplier":0.4},
{"id":155,"fromStat":[16],"toStat":[4],"multiplier":0.4},
{"id":156,"fromStat":[16],"toStat":[25],"multiplier":0.4},
{"id":157,"fromStat":[16],"toStat":[26],"multiplier":0.4},
{"id":158,"fromStat":[16],"toStat":[12,7],"multiplier":0.4},
{"id":159,"fromStat":[16],"toStat":[13,8],"multiplier":0.4},
{"id":160,"fromStat":[16],"toStat":[14,9],"multiplier":0.4},
{"id":161,"fromStat":[16],"multiplier":0.4},
{"id":162,"toStat":[4],"multiplier":0.4},
{"id":163,"toStat":[25],"multiplier":0.4},
{"id":164,"toStat":[26],"multiplier":0.4},
{"id":165,"toStat":[12,7],"multiplier":0.4},
{"id":166,"toStat":[13,8],"multiplier":0.4},
{"id":167,"toStat":[14,9],"multiplier":0.4},
{"id":168,"toStat":[16],"multiplier":0.4}
],
"itemIcons":[
{"id":7676,"name":"Thistle Tea","icon":"inv_drink_milk_05"},
{"id":9088,"name":"Gift of Arthas","icon":"inv_potion_28"},
Expand Down Expand Up @@ -11008,6 +11066,7 @@
{"id":34296,"name":"Pyromaniac","icon":"spell_fire_burnout"},
{"id":34297,"name":"Improved Leader of the Pack","icon":"spell_nature_unyeildingstamina"},
{"id":34300,"name":"Improved Leader of the Pack","icon":"spell_nature_unyeildingstamina"},
{"id":34433,"name":"Shadowfiend","icon":"spell_shadow_shadowfiend"},
{"id":34453,"name":"Animal Handler","icon":"ability_hunter_animalhandler"},
{"id":34454,"name":"Animal Handler","icon":"ability_hunter_animalhandler"},
{"id":34455,"name":"Ferocious Inspiration","icon":"ability_hunter_ferociousinspiration"},
Expand Down Expand Up @@ -11845,6 +11904,7 @@
{"id":52803,"name":"Twin Disciplines","icon":"spell_holy_sealofvengeance"},
{"id":52858,"name":"Culling the Herd","icon":"inv_misc_monsterhorn_06"},
{"id":53007,"name":"Penance","icon":"spell_holy_penance"},
{"id":53022,"name":"Mind Sear","icon":"spell_shadow_mindshear"},
{"id":53023,"name":"Mind Sear","icon":"spell_shadow_mindshear"},
{"id":53137,"name":"Abomination's Might","icon":"ability_warrior_intensifyrage"},
{"id":53138,"name":"Abomination's Might","icon":"ability_warrior_intensifyrage"},
Expand Down Expand Up @@ -12254,6 +12314,7 @@
{"id":57699,"name":"Fur Lining - Nature Resist","icon":"trade_leatherworking"},
{"id":57701,"name":"Fur Lining - Arcane Resist","icon":"trade_leatherworking"},
{"id":57722,"name":"Totem of Wrath","icon":"spell_fire_totemofwrath"},
{"id":57724,"name":"Sated","icon":"spell_nature_sleep"},
{"id":57755,"name":"Heroic Throw","icon":"inv_axe_66"},
{"id":57810,"name":"Genesis","icon":"spell_arcane_arcane03"},
{"id":57811,"name":"Genesis","icon":"spell_arcane_arcane03"},
Expand Down Expand Up @@ -12374,10 +12435,12 @@
{"id":60185,"name":"Elemental Fury","icon":"spell_fire_volcano"},
{"id":60187,"name":"Elemental Fury","icon":"spell_fire_volcano"},
{"id":60188,"name":"Elemental Fury","icon":"spell_fire_volcano"},
{"id":60229,"name":"Greatness","icon":"inv_inscription_tarotgreatness"},
{"id":60396,"name":"Mercurial Alchemist Stone","icon":"spell_holy_aspiration"},
{"id":60403,"name":"Indestructible Alchemist Stone","icon":"spell_holy_aspiration"},
{"id":60405,"name":"Mighty Alchemist Stone","icon":"spell_holy_aspiration"},
{"id":60432,"name":"Earth and Moon","icon":"ability_druid_earthandsky"},
{"id":60494,"name":"Dying Curse","icon":"spell_holy_mindvision"},
{"id":60581,"name":"Frosthide Leg Armor","icon":"trade_leatherworking"},
{"id":60582,"name":"Icescale Leg Armor","icon":"trade_leatherworking"},
{"id":60583,"name":"Jormungar Leg Reinforcements","icon":"trade_leatherworking"},
Expand Down
Binary file modified assets/database/leftover_db.bin
Binary file not shown.
58 changes: 58 additions & 0 deletions assets/database/leftover_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -12896,6 +12896,64 @@
],
"npcs":[
],
"reforgeStats":[
{"id":113,"fromStat":[4],"toStat":[25],"multiplier":0.4},
{"id":114,"fromStat":[4],"toStat":[26],"multiplier":0.4},
{"id":115,"fromStat":[4],"toStat":[12,7],"multiplier":0.4},
{"id":116,"fromStat":[4],"toStat":[13,8],"multiplier":0.4},
{"id":117,"fromStat":[4],"toStat":[14,9],"multiplier":0.4},
{"id":118,"fromStat":[4],"toStat":[16],"multiplier":0.4},
{"id":119,"fromStat":[4],"multiplier":0.4},
{"id":120,"fromStat":[25],"toStat":[4],"multiplier":0.4},
{"id":121,"fromStat":[25],"toStat":[26],"multiplier":0.4},
{"id":122,"fromStat":[25],"toStat":[12,7],"multiplier":0.4},
{"id":123,"fromStat":[25],"toStat":[13,8],"multiplier":0.4},
{"id":124,"fromStat":[25],"toStat":[14,9],"multiplier":0.4},
{"id":125,"fromStat":[25],"toStat":[16],"multiplier":0.4},
{"id":126,"fromStat":[25],"multiplier":0.4},
{"id":127,"fromStat":[26],"toStat":[4],"multiplier":0.4},
{"id":128,"fromStat":[26],"toStat":[25],"multiplier":0.4},
{"id":129,"fromStat":[26],"toStat":[12,7],"multiplier":0.4},
{"id":130,"fromStat":[26],"toStat":[13,8],"multiplier":0.4},
{"id":131,"fromStat":[26],"toStat":[14,9],"multiplier":0.4},
{"id":132,"fromStat":[26],"toStat":[16],"multiplier":0.4},
{"id":133,"fromStat":[26],"multiplier":0.4},
{"id":134,"fromStat":[12,7],"toStat":[4],"multiplier":0.4},
{"id":135,"fromStat":[12,7],"toStat":[25],"multiplier":0.4},
{"id":136,"fromStat":[12,7],"toStat":[26],"multiplier":0.4},
{"id":137,"fromStat":[12,7],"toStat":[13,8],"multiplier":0.4},
{"id":138,"fromStat":[12,7],"toStat":[14,9],"multiplier":0.4},
{"id":139,"fromStat":[12,7],"toStat":[16],"multiplier":0.4},
{"id":140,"fromStat":[12,7],"multiplier":0.4},
{"id":141,"fromStat":[13,8],"toStat":[4],"multiplier":0.4},
{"id":142,"fromStat":[13,8],"toStat":[25],"multiplier":0.4},
{"id":143,"fromStat":[13,8],"toStat":[26],"multiplier":0.4},
{"id":144,"fromStat":[13,8],"toStat":[12,7],"multiplier":0.4},
{"id":145,"fromStat":[13,8],"toStat":[14,9],"multiplier":0.4},
{"id":146,"fromStat":[13,8],"toStat":[16],"multiplier":0.4},
{"id":147,"fromStat":[13,8],"multiplier":0.4},
{"id":148,"fromStat":[14,9],"toStat":[4],"multiplier":0.4},
{"id":149,"fromStat":[14,9],"toStat":[25],"multiplier":0.4},
{"id":150,"fromStat":[14,9],"toStat":[26],"multiplier":0.4},
{"id":151,"fromStat":[14,9],"toStat":[12,7],"multiplier":0.4},
{"id":152,"fromStat":[14,9],"toStat":[13,8],"multiplier":0.4},
{"id":153,"fromStat":[14,9],"toStat":[16],"multiplier":0.4},
{"id":154,"fromStat":[14,9],"multiplier":0.4},
{"id":155,"fromStat":[16],"toStat":[4],"multiplier":0.4},
{"id":156,"fromStat":[16],"toStat":[25],"multiplier":0.4},
{"id":157,"fromStat":[16],"toStat":[26],"multiplier":0.4},
{"id":158,"fromStat":[16],"toStat":[12,7],"multiplier":0.4},
{"id":159,"fromStat":[16],"toStat":[13,8],"multiplier":0.4},
{"id":160,"fromStat":[16],"toStat":[14,9],"multiplier":0.4},
{"id":161,"fromStat":[16],"multiplier":0.4},
{"id":162,"toStat":[4],"multiplier":0.4},
{"id":163,"toStat":[25],"multiplier":0.4},
{"id":164,"toStat":[26],"multiplier":0.4},
{"id":165,"toStat":[12,7],"multiplier":0.4},
{"id":166,"toStat":[13,8],"multiplier":0.4},
{"id":167,"toStat":[14,9],"multiplier":0.4},
{"id":168,"toStat":[16],"multiplier":0.4}
],
"itemIcons":[
],
"spellIcons":[
Expand Down
13 changes: 11 additions & 2 deletions sim/core/apl.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,18 @@ 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
14 changes: 1 addition & 13 deletions sim/core/database.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package core

import (
"encoding/json"
"fmt"
"math"

Expand Down Expand Up @@ -291,18 +290,7 @@ func NewItem(itemSpec ItemSpec) Item {
if validateReforging(&item, reforge) {
item.Reforging = &reforge
} else {
reforgeJSON, err := json.Marshal(reforge)
reforgeJSOsN, err2 := json.Marshal(ReforgeStatsByID)
if err != nil {
// Handle JSON marshaling error, perhaps with a simpler panic message
panic(fmt.Sprintf("Error marshaling reforge to JSON for item %d: %v", itemSpec.ID, err))
}
if err2 != nil {
// Handle JSON marshaling error, perhaps with a simpler panic message
panic(fmt.Sprintf("Error marshaling reforge to JSON for item %d: %v", itemSpec.ID, err))
}
panic(fmt.Sprintf("When validating reforging for item %d, the reforging could not be validated. %d Reforging details: %s, %s", itemSpec.ID, itemSpec.Reforging, string(reforgeJSON), string(reforgeJSOsN)))

panic(fmt.Sprintf("When validating reforging for item %d, the reforging could not be validated. %d", itemSpec.ID, itemSpec.Reforging))
}
}

Expand Down
16 changes: 13 additions & 3 deletions sim/core/database_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ func init() {
WITH_DB = true

simDB := &proto.SimDatabase{
Items: make([]*proto.SimItem, len(db.Items)),
Enchants: make([]*proto.SimEnchant, len(db.Enchants)),
Gems: make([]*proto.SimGem, len(db.Gems)),
Items: make([]*proto.SimItem, len(db.Items)),
Enchants: make([]*proto.SimEnchant, len(db.Enchants)),
Gems: make([]*proto.SimGem, len(db.Gems)),
ReforgeStats: make([]*proto.ReforgeStat, len(db.ReforgeStats)),
}

for i, item := range db.Items {
Expand Down Expand Up @@ -54,5 +55,14 @@ func init() {
}
}

for i, reforgeStat := range db.ReforgeStats {
simDB.ReforgeStats[i] = &proto.ReforgeStat{
Id: reforgeStat.Id,
FromStat: reforgeStat.FromStat,
ToStat: reforgeStat.ToStat,
Multiplier: reforgeStat.Multiplier,
}
}

addToDatabase(simDB)
}
Loading

0 comments on commit bb7a2a4

Please sign in to comment.