Skip to content

Commit

Permalink
Big overhaul of UI. Small bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lologarithm committed Apr 8, 2021
1 parent 0b88051 commit 4aa2e3e
Show file tree
Hide file tree
Showing 35 changed files with 744 additions and 776 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
icons
wowsim
.vscode
13 changes: 6 additions & 7 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@ TODO:
UI
Could use a real design
Icons
Gear Colors
Gear Quality Colors
Gear Change data on hover of item change dropdown.
Gear Stats on hover
Gem Display

Items
Gems
Gem Slots in existing items.
Gear Quality
Trinkets
Validate gear stats

Validate gear stats - unsure if item data source is accurate.
Enchants

Engine
Gem Auras
Socket Bonuses
Set Bonuses
Upgrader - find upgrade for a single piece.
Upgrader - find upgrade for a single piece? If we can get stat weights we can do it all.

Other
Implement Gear Phases
seventyupgrades importer
Add armor type to allow for a 'mail-only' optimization
Binary file added icons/Armor/INV_Belt_19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Boots_Wolf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Bracer_09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Chest_Chain_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Gauntlets_26.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Helmet_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Jewelry_Necklace_07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Jewelry_Ring_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Jewelry_Ring_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Jewelry_Talisman_09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Jewelry_Talisman_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Misc_Cape_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Pants_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Shield_20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Armor/INV_Shoulder_14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Spells/Spell_Nature_InvisibilityTotem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Trade/Trade_Engraving.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Weapons/INV_Sword_39.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 17 additions & 4 deletions itemparser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,27 @@ func main() {
numYellow, _ := strconv.Atoi(v[14])
numBlue, _ := strconv.Atoi(v[15])

gemBonus := tbc.Stats{}
if len(v[15]) > 0 {
// parse out socket bonus
tokens := strings.Split(v[15], " ")
val := strconv.Atoi()
val, _ := strconv.Atoi(tokens[0])
if len(tokens) == 2 {

if tokens[1] == "int" {
gemBonus[tbc.StatInt] = float64(val)
} else if tokens[1] == "mp5" {
gemBonus[tbc.StatMP5] = float64(val)
}
} else if len(tokens) == 3 {

if tokens[1] == "spell" {
if tokens[2] == "crit" {
gemBonus[tbc.StatSpellCrit] = float64(val)
} else if tokens[2] == "hit" {
gemBonus[tbc.StatSpellHit] = float64(val)
} else if tokens[2] == "dmg" {
gemBonus[tbc.StatSpellDmg] = float64(val)
}
}
}
}
it := tbc.Item{
Expand All @@ -115,7 +128,7 @@ func main() {
tbc.StatHaste: haste,
tbc.StatMP5: mp5,
},
GemSlots: make([]tbc.GemColor, numMeta+numRed+numYellow+numBlue),
GemSlots: make([]tbc.GemColor, 0, numMeta+numRed+numYellow+numBlue),
}
if numMeta > 0 { // its always 1 or 0
it.GemSlots = append(it.GemSlots, tbc.GemColorMeta)
Expand Down
11 changes: 3 additions & 8 deletions tbc/auras.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func AuraLightningOverload(lvl int) Aura {
if c.Spell.ID != MagicIDLB12 && c.Spell.ID != MagicIDCL6 {
return
}
if c.isLO {
if c.IsLO {
return // can't proc LO on LO
}
if sim.rando.Float64() < 0.04*float64(lvl) {
Expand All @@ -138,17 +138,12 @@ func AuraLightningOverload(lvl int) Aura {
dmg /= 2
}
clone := &Cast{
isLO: true,
IsLO: true,
Spell: c.Spell,
Hit: c.Hit,
Crit: c.Crit,
Spellpower: c.Spellpower,
DidDmg: dmg,
Effects: []AuraEffect{
func(sim *Simulation, c *Cast) {
c.DidDmg /= 2
},
},
Effects: []AuraEffect{func(sim *Simulation, c *Cast) { c.DidDmg /= 2 }},
}
sim.Cast(clone)
}
Expand Down
4 changes: 1 addition & 3 deletions tbc/buffs.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package tbc

import "fmt"

type Options struct {
SpellOrder []string
UseAI bool // when set true, the AI will modulate the rotations to maximize DPS and mana.
Expand Down Expand Up @@ -37,7 +35,7 @@ func (o Options) StatTotal(e Equipment) Stats {
// Final calculations
stats[StatSpellCrit] += (stats[StatInt] / 80) / 100
stats[StatMana] += stats[StatInt] * 15
fmt.Printf("\fFinal MP5: %f", (stats[StatMP5] + (stats[StatInt] * 0.06)))
// fmt.Printf("\fFinal MP5: %f", (stats[StatMP5] + (stats[StatInt] * 0.06)))

return stats
}
Expand Down
809 changes: 335 additions & 474 deletions tbc/items.go

Large diffs are not rendered by default.

61 changes: 30 additions & 31 deletions tbc/optimizer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tbc

import (
"fmt"
"math"
)

Expand All @@ -15,7 +14,7 @@ var rotations = [][]string{
// Finds the optimal rotation for given parameters.
func OptimalRotation(stats Stats, opts Options, equip Equipment, seconds int, numSims int) ([]SimMetrics, []string) {

fmt.Printf("Starting optimize...\n")
// fmt.Printf("Starting optimize...\n")

topDmg := 0.0
topRot := []string{}
Expand All @@ -35,7 +34,7 @@ func OptimalRotation(stats Stats, opts Options, equip Equipment, seconds int, nu
oomat := 0
numoom := 0
simdmg := 0.0
fmt.Printf("Starting opt sim: %v\n", rotation)
// fmt.Printf("Starting opt sim: %v\n", rotation)
sopts := opts
sopts.SpellOrder = rotation
sim := NewSim(stats, equip, sopts)
Expand All @@ -60,7 +59,7 @@ func OptimalRotation(stats Stats, opts Options, equip Equipment, seconds int, nu
}

avgOOM := float64(numoom) / float64(numSims)
fmt.Printf("(%d LB: 1 CL) %0.0f DPS OOM: %0.0f percent\n", numLB, simdmg/float64(seconds)/float64(numSims), avgOOM*100)
// fmt.Printf("(%d LB: 1 CL) %0.0f DPS OOM: %0.0f percent\n", numLB, simdmg/float64(seconds)/float64(numSims), avgOOM*100)

if numLB == minLB || numLB == maxLB {
if simdmg >= topDmg {
Expand Down Expand Up @@ -101,44 +100,44 @@ func OptimalRotation(stats Stats, opts Options, equip Equipment, seconds int, nu
}

// Optimal Found
fmt.Printf("Optimal Found: %0.0f DPS (%d LB : 1 CL)\n", simdmg/float64(seconds)/float64(numSims), numLB)
// fmt.Printf("Optimal Found: %0.0f DPS (%d LB : 1 CL)\n", simdmg/float64(seconds)/float64(numSims), numLB)
printResult(simmet, seconds)
return simmet, rotation
}

}

func printResult(metrics []SimMetrics, seconds int) {
numSims := len(metrics)
simDmgs := make([]float64, 0, numSims)
for _, metric := range metrics {
simDmgs = append(simDmgs, metric.TotalDamage)
}
// numSims := len(metrics)
// simDmgs := make([]float64, 0, numSims)
// for _, metric := range metrics {
// simDmgs = append(simDmgs, metric.TotalDamage)
// }

totalDmg := 0.0
tdSq := totalDmg
max := 0.0
for _, dmg := range simDmgs {
totalDmg += dmg
tdSq += dmg * dmg
// totalDmg := 0.0
// tdSq := totalDmg
// max := 0.0
// for _, dmg := range simDmgs {
// totalDmg += dmg
// tdSq += dmg * dmg

if dmg > max {
max = dmg
}
}
// if dmg > max {
// max = dmg
// }
// }

meanSq := tdSq / float64(numSims)
mean := totalDmg / float64(numSims)
stdev := math.Sqrt(meanSq - mean*mean)
// meanSq := tdSq / float64(numSims)
// mean := totalDmg / float64(numSims)
// stdev := math.Sqrt(meanSq - mean*mean)

fmt.Printf("DPS:\n")
fmt.Printf("\tMean: %0.1f\n", (mean / float64(seconds)))
fmt.Printf("\tMax: %0.1f\n", (max / float64(seconds)))
fmt.Printf("\tStd.Dev: %0.1f\n", stdev/float64(seconds))
fmt.Printf("Total Casts:\n")
// fmt.Printf("DPS:\n")
// fmt.Printf("\tMean: %0.1f\n", (mean / float64(seconds)))
// fmt.Printf("\tMax: %0.1f\n", (max / float64(seconds)))
// fmt.Printf("\tStd.Dev: %0.1f\n", stdev/float64(seconds))
// fmt.Printf("Total Casts:\n")

// for k, v := range casts {
// fmt.Printf("\t%s: %d\n", tbc.AuraName(k), v/numSims)
// fmt.Printf("\t%s: %d\n", tbc.AuraName(k), v/numSims)
// }

}
Expand Down Expand Up @@ -253,7 +252,7 @@ func (ai *EleAI) ChooseSpell(sim *Simulation, didPot bool) int {
// // Get mana remaining
// avgMana /= numSims
// dps /= float64(numSims * (seconds - opts.NumBloodlust*40))
// fmt.Printf("Rot: %s, Mana Left: %v\n", p1Res.R, avgMana)
// fmt.Printf("Rot: %s, Mana Left: %v\n", p1Res.R, avgMana)
// // if avgMana < 1000 {
// // // If you dont have 1000 mana to spare on average, there is little value in BL.
// // // This is disregarding 'critical' phases of boss fights where you might conserve mana until that spot, and then BL.
Expand Down Expand Up @@ -288,7 +287,7 @@ func (ai *EleAI) ChooseSpell(sim *Simulation, didPot bool) int {
// bldps := bltotal / float64(opts.NumBloodlust*40)

// totaltotal := int((nr.oDPS*float64(seconds-opts.NumBloodlust*40))+bltotal) / seconds
// fmt.Printf("BASE(%s): %0.0f, BL(%s): %0.0f, TOTAL: %d\n", nr.OR, nr.oDPS, nr.R, bldps, totaltotal)
// fmt.Printf("BASE(%s): %0.0f, BL(%s): %0.0f, TOTAL: %d\n", nr.OR, nr.oDPS, nr.R, bldps, totaltotal)
// }
// }

Expand Down
10 changes: 6 additions & 4 deletions tbc/sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ type Simulation struct {
Equip Equipment // Current Gear
activeEquip Equipment // cache of gear that can activate.

Options Options
SpellRotation []int32
RotationIdx int
bloodlustCasts int
Options Options
SpellRotation []int32
RotationIdx int

// ticks until cast is complete
CastingSpell *Cast
Expand Down Expand Up @@ -60,7 +61,7 @@ type SimMetrics struct {
// mostly for stat weight purposes.
func NewSim(stats Stats, equip Equipment, options Options) *Simulation {
if len(options.SpellOrder) == 0 {
fmt.Printf("[ERROR] No rotation given to sim.\n")
// fmt.Printf("[ERROR] No rotation given to sim.\n")
return nil
}
rotIdx := 0
Expand Down Expand Up @@ -120,6 +121,7 @@ func (sim *Simulation) reset() {
sim.SpellChooser = ai.ChooseSpell
}

sim.bloodlustCasts = 0
sim.currentTick = 0
sim.CurrentMana = sim.Stats[StatMana]
sim.CastingSpell = nil
Expand Down
4 changes: 2 additions & 2 deletions tbc/sim2.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ func (sim *Simulation) Spellcasting(tickID int) int {

if sim.CastingSpell == nil {
// Activate any specials
if sim.Options.NumBloodlust > 0 && sim.CDs[MagicIDBloodlust] < 1 {
if sim.Options.NumBloodlust > sim.bloodlustCasts && sim.CDs[MagicIDBloodlust] < 1 {
sim.addAura(ActivateBloodlust(sim))
sim.Options.NumBloodlust-- // TODO: will this break anything?
sim.bloodlustCasts++ // TODO: will this break anything?
}

if sim.Options.Talents.ElementalMastery && sim.CDs[MagicIDEleMastery] < 1 {
Expand Down
2 changes: 1 addition & 1 deletion tbc/spells.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tbc
type Cast struct {
Spell *Spell
// Caster ... // Needed for onstruck effects?
isLO bool // stupid hack
IsLO bool // stupid hack

// Pre-hit Mutatable State
TicksUntilCast int
Expand Down
Loading

0 comments on commit 4aa2e3e

Please sign in to comment.