Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ enum Stat {
StatBlockValue = 32;
StatDodgeRating = 33;
StatParryRating = 34;
StatResilience = 35;
StatResilienceRating = 35;
StatArmor = 36;
StatBonusArmor = 37;

Expand Down
10 changes: 5 additions & 5 deletions sim/core/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,12 @@ func NewItem(itemSpec ItemSpec) Item {
panic(fmt.Sprintf("No item with id: %d", itemSpec.ID))
}

// TODO: Pull the direct stats
// item.Stats = stats.FromProtoMap(scalingOptions.Stats)
scalingOptions := item.ScalingOptions[0]
item.Stats = stats.FromProtoMap(scalingOptions.Stats)

// item.WeaponDamageMax = scalingOptions.WeaponDamageMax
// item.WeaponDamageMin = scalingOptions.WeaponDamageMin
// item.RandPropPoints = scalingOptions.RandPropPoints
item.WeaponDamageMax = scalingOptions.WeaponDamageMax
item.WeaponDamageMin = scalingOptions.WeaponDamageMin
item.RandPropPoints = scalingOptions.RandPropPoints

if itemSpec.RandomSuffix != 0 {
if randomSuffix, ok := RandomSuffixesByID[itemSpec.RandomSuffix]; ok {
Expand Down
10 changes: 5 additions & 5 deletions sim/core/pet.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ func makeStatInheritanceFunc(nonHitExpStatInheritance PetStatInheritance) PetSta
inheritedStats := nonHitExpStatInheritance(ownerStats)

// TODO: I dunno how this works in TBC
// hitRating := ownerStats[stats.HitRating]
// expertiseRating := ownerStats[stats.ExpertiseRating]
// combined := (hitRating + expertiseRating) * 0.5
hitRating := ownerStats[stats.MeleeHitRating]
expertiseRating := ownerStats[stats.ExpertiseRating]
combined := (hitRating + expertiseRating) * 0.5

// inheritedStats[stats.HitRating] = combined
// inheritedStats[stats.ExpertiseRating] = combined
inheritedStats[stats.MeleeHitRating] = combined
inheritedStats[stats.ExpertiseRating] = combined

return inheritedStats
}
Expand Down
12 changes: 9 additions & 3 deletions sim/core/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
BlockValue
DodgeRating
ParryRating
Resilience
ResilienceRating
Armor
BonusArmor
Health
Expand Down Expand Up @@ -157,6 +157,12 @@ func (s Stat) StatName() string {
return "MeleeHasteRating"
case ExpertiseRating:
return "ExpertiseRating"
case AllHitRating:
return "HitRating"
case AllCritRating:
return "CritRating"
case AllHasteRating:
return "HasteRating"
case ArmorPenetration:
return "ArmorPenetration"
case DodgeRating:
Expand All @@ -171,8 +177,8 @@ func (s Stat) StatName() string {
return "FeralAttackPower"
case SpellPower:
return "SpellPower"
case Resilience:
return "PvpResilienceRating"
case ResilienceRating:
return "ResilienceRating"
case Armor:
return "Armor"
case BonusArmor:
Expand Down
56 changes: 33 additions & 23 deletions sim/core/statweight.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package core

import (
"fmt"
"math"
"strings"
"time"

"github.com/wowsims/tbc/sim/core/proto"
Expand Down Expand Up @@ -77,10 +79,10 @@ func NewStatWeightValues() StatWeightValues {

func (swv *StatWeightValues) ToProto() *proto.StatWeightValues {
return &proto.StatWeightValues{
Weights: swv.Weights.ToProto(),
WeightsStdev: swv.WeightsStdev.ToProto(),
EpValues: swv.EpValues.ToProto(),
EpValuesStdev: swv.EpValuesStdev.ToProto(),
Weights: swv.Weights.ExportWeights(),
WeightsStdev: swv.WeightsStdev.ExportWeights(),
EpValues: swv.EpValues.ExportWeights(),
EpValuesStdev: swv.EpValuesStdev.ExportWeights(),
}
}

Expand Down Expand Up @@ -179,21 +181,22 @@ func buildStatWeightRequests(swr *proto.StatWeightsRequest) *proto.StatWeightReq
}
for _, s := range swr.PseudoStatsToWeigh {
stat := stats.UnitStatFromPseudoStat(s)
// statName := proto.PseudoStat_name[int32(s)]
statName := proto.PseudoStat_name[int32(s)]
// Scale down the stat increment depending on the type of PseudoStat
statMod := defaultStatMod

// if stat.EqualsPseudoStat(proto.PseudoStat_PseudoStatPhysicalHitPercent) {
// statMod /= PhysicalHitRatingPerHitPercent
// } else if stat.EqualsPseudoStat(proto.PseudoStat_PseudoStatSpellHitPercent) {
// statMod /= SpellHitRatingPerHitPercent
// } else if strings.Contains(statName, "Crit") {
// statMod /= CritRatingPerCritPercent
// } else if strings.Contains(statName, "Dps") {
// statMod *= 0.5
// } else {
// panic(fmt.Sprintf("Unsupported PseudoStat in stat weights request: %s", statName))
// }
if stat.EqualsPseudoStat(proto.PseudoStat_PseudoStatMeleeHitPercent) ||
stat.EqualsPseudoStat(proto.PseudoStat_PseudoStatRangedHitPercent) {
statMod /= PhysicalHitRatingPerHitPercent
} else if stat.EqualsPseudoStat(proto.PseudoStat_PseudoStatSpellHitPercent) {
statMod /= SpellHitRatingPerHitPercent
} else if strings.Contains(statName, "Crit") {
statMod /= PhysicalCritRatingPerCritPercent // These are the same
} else if strings.Contains(statName, "Dps") {
statMod *= 0.5
} else {
panic(fmt.Sprintf("Unsupported PseudoStat in stat weights request: %s", statName))
}

statModsHigh[stat] = statMod
statModsLow[stat] = -statMod
Expand All @@ -203,13 +206,20 @@ func buildStatWeightRequests(swr *proto.StatWeightsRequest) *proto.StatWeightReq
// avoid unnecessary computations. The base Rating EP will be
// reconstructed from the PseudoStat EPs when writing the final
// results.
// if strings.Contains(statName, "Hit") {
// statModsLow[stats.HitRating] = 0
// statModsHigh[stats.HitRating] = 0
// } else if strings.Contains(statName, "Crit") {
// statModsLow[stats.CritRating] = 0
// statModsHigh[stats.CritRating] = 0
// }
if strings.Contains(statName, "MeleeHit") ||
strings.Contains(statName, "RangedHit") {
statModsLow[stats.MeleeHitRating] = 0
statModsHigh[stats.MeleeHitRating] = 0
} else if strings.Contains(statName, "Hit") {
statModsLow[stats.SpellHitRating] = 0
statModsLow[stats.SpellHitRating] = 0
} else if strings.Contains(statName, "MeleeCrit") {
statModsLow[stats.MeleeCritRating] = 0
statModsHigh[stats.MeleeCritRating] = 0
} else if strings.Contains(statName, "Crit") {
statModsLow[stats.SpellCritRating] = 0
statModsHigh[stats.SpellCritRating] = 0
}

}

Expand Down
10 changes: 5 additions & 5 deletions tools/database/dbc/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/wowsims/tbc/sim/core/stats"
)

const UPGRADE_SYSTEM_ACTIVE = true
const UPGRADE_SYSTEM_ACTIVE = false

type Item struct {
Id int
Expand Down Expand Up @@ -128,7 +128,7 @@ func (item *Item) GetStats(itemLevel int) *stats.Stats {
// Skip this stat then
continue
}
stats[stat] = item.BonusAmountCalculated[i]
stats[stat] = item.GetScaledStat(i, itemLevel)
}

armor := item.GetArmorValue(itemLevel)
Expand Down Expand Up @@ -209,9 +209,9 @@ func (item *Item) GetGemBonus() stats.Stats {
value := bonus.EffectPointsMin[i]
stats[stat] = float64(value)
//Todo: check if this is always true
if stat == proto.Stat_StatAttackPower {
stats[proto.Stat_StatRangedAttackPower] = float64(value)
}
// if stat == proto.Stat_StatAttackPower {
// stats[proto.Stat_StatRangedAttackPower] = float64(value)
// }
}
return stats
}
Expand Down
2 changes: 1 addition & 1 deletion tools/database/dbc/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ var RatingModToStat = map[RatingModType]proto.Stat{
RATING_MOD_MULTISTRIKE: -1,
RATING_MOD_READINESS: -1,
RATING_MOD_SPEED: -1,
RATING_MOD_RESILIENCE: proto.Stat_StatResilience,
RATING_MOD_RESILIENCE: proto.Stat_StatResilienceRating,
RATING_MOD_LEECH: -1,
RATING_MOD_HASTE_MELEE: proto.Stat_StatMeleeHasteRating,
RATING_MOD_HASTE_RANGED: proto.Stat_StatMeleeHasteRating,
Expand Down
2 changes: 1 addition & 1 deletion tools/database/dbc/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func ConvertModRatingFlagToRatingStat(flag int) proto.Stat {
case 393216:
return proto.Stat_StatMeleeHasteRating
case 49152:
return proto.Stat_StatResilience
return proto.Stat_StatResilienceRating
default:
println("UNHANDLED RATING FLAG: " + strconv.Itoa(flag))
return proto.Stat_StatRage
Expand Down
40 changes: 14 additions & 26 deletions ui/core/components/character_stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ export class CharacterStats extends Component {
[
UnitStat.fromStat(Stat.StatAttackPower),
UnitStat.fromStat(Stat.StatRangedAttackPower),
UnitStat.fromStat(Stat.StatFeralAttackPower),
UnitStat.fromStat(Stat.StatArmorPenetration),
UnitStat.fromPseudoStat(PseudoStat.PseudoStatMeleeHastePercent),
UnitStat.fromPseudoStat(PseudoStat.PseudoStatRangedHastePercent),
UnitStat.fromPseudoStat(PseudoStat.PseudoStatMeleeHitPercent),
//UnitStat.fromStat(Stat.StatExpertiseRating),
UnitStat.fromPseudoStat(PseudoStat.PseudoStatMeleeCritPercent),
UnitStat.fromPseudoStat(PseudoStat.PseudoStatRangedHitPercent),
UnitStat.fromPseudoStat(PseudoStat.PseudoStatRangedCritPercent),
UnitStat.fromStat(Stat.StatExpertiseRating),
UnitStat.fromStat(Stat.StatArmorPenetration),

],
],
[
Expand All @@ -111,19 +111,17 @@ export class CharacterStats extends Component {
],
]);

// if (this.player.getPlayerSpec().isTankSpec) {
// const hitIndex = statGroups.get(StatGroup.Physical)!.findIndex(stat => stat.equalsPseudoStat(PseudoStat.PseudoStatPhysicalHitPercent));
// statGroups.get(StatGroup.Physical)!.splice(hitIndex+1, 0, UnitStat.fromStat(Stat.StatExpertiseRating));
// statGroups.get(StatGroup.Defense)!.push(UnitStat.fromStat(Stat.StatMasteryRating));
// } else if ([Stat.StatIntellect, Stat.StatSpellPower].includes(simUI.individualConfig.epReferenceStat)) {
// const hitIndex = statGroups.get(StatGroup.Spell)!.findIndex(stat => stat.equalsPseudoStat(PseudoStat.PseudoStatSpellHitPercent));
// statGroups.get(StatGroup.Spell)!.splice(hitIndex+1, 0, UnitStat.fromStat(Stat.StatExpertiseRating));
// statGroups.get(StatGroup.Spell)!.push(UnitStat.fromStat(Stat.StatMasteryRating));
// } else {
// const hitIndex = statGroups.get(StatGroup.Physical)!.findIndex(stat => stat.equalsPseudoStat(PseudoStat.PseudoStatPhysicalHitPercent));
// statGroups.get(StatGroup.Physical)!.splice(hitIndex+1, 0, UnitStat.fromStat(Stat.StatExpertiseRating));
// statGroups.get(StatGroup.Physical)!.push(UnitStat.fromStat(Stat.StatMasteryRating));
// }
if (this.player.getPlayerSpec().isTankSpec) {
const hitIndex = statGroups.get(StatGroup.Physical)!.findIndex(stat => stat.equalsPseudoStat(PseudoStat.PseudoStatMeleeHitPercent));
statGroups.get(StatGroup.Physical)!.splice(hitIndex+1, 0, UnitStat.fromStat(Stat.StatExpertiseRating));
// statGroups.get(StatGroup.Defense)!.push(UnitStat.fromStat(Stat.StatDefenseRating));
} else if ([Stat.StatIntellect, Stat.StatSpellPower].includes(simUI.individualConfig.epReferenceStat)) {
const hitIndex = statGroups.get(StatGroup.Spell)!.findIndex(stat => stat.equalsPseudoStat(PseudoStat.PseudoStatSpellHitPercent));
// statGroups.get(StatGroup.Spell)!.splice(hitIndex+1, 0, UnitStat.fromStat(Stat.StatExpertiseRating));
} else {
const hitIndex = statGroups.get(StatGroup.Physical)!.findIndex(stat => stat.equalsPseudoStat(PseudoStat.PseudoStatMeleeHitPercent));
statGroups.get(StatGroup.Physical)!.splice(hitIndex+1, 0, UnitStat.fromStat(Stat.StatExpertiseRating));
}

statGroups.forEach((groupedStats, key) => {
const filteredStats = groupedStats.filter(stat => statList.find(listStat => listStat.equals(stat)));
Expand Down Expand Up @@ -281,16 +279,6 @@ export class CharacterStats extends Component {
<span>{i18n.t('sidebar.character_stats.tooltip.total')}</span>
<span>{this.statDisplayString(finalStats, unitStat, true)}</span>
</div>
{unitStat.isPseudoStat() && unitStat.getPseudoStat() === PseudoStat.PseudoStatSpellHitPercent && (
<div className="character-stats-tooltip-row">
<span><i>Total Includes Expertise</i></span>
</div>
)}
{unitStat.isStat() && unitStat.getStat() === Stat.StatExpertiseRating && (
<div className="character-stats-tooltip-row">
<span><i>Contributes to Spell Hit</i></span>
</div>
)}
</div>
);

Expand Down
7 changes: 0 additions & 7 deletions ui/core/components/gear_picker/gear_picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,6 @@ export class ItemRenderer extends Component {

newItem.allSocketColors().forEach((socketColor, gemIdx) => {
const gemContainer = createGemContainer(socketColor, newItem.gems[gemIdx], gemIdx);
if (gemIdx === newItem.numPossibleSockets - 1 && newItem.couldHaveExtraSocket()) {
const updateProfession = () => {
gemContainer.classList[this.player.isBlacksmithing() ? 'remove' : 'add']('hide');
};
this.player.professionChangeEmitter.on(updateProfession);
updateProfession();
}
this.socketsElem.push(gemContainer);
this.socketsContainerElem.appendChild(gemContainer);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class Individual60UEPExporter<SpecType extends Spec> extends IndividualEx
[Stat.StatDefenseRating]: '',
[Stat.StatBlockRating]: '',
[Stat.StatBlockValue]: '',
[Stat.StatResilience]: '',
[Stat.StatResilienceRating]: '',
[Stat.StatArcaneResistance]: '',
[Stat.StatFireResistance]: '',
[Stat.StatFrostResistance]: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class IndividualPawnEPExporter<SpecType extends Spec> extends IndividualE
[Stat.StatDefenseRating]: '',
[Stat.StatBlockRating]: '',
[Stat.StatBlockValue]: '',
[Stat.StatResilience]: '',
[Stat.StatResilienceRating]: '',
[Stat.StatArcaneResistance]: '',
[Stat.StatFireResistance]: '',
[Stat.StatFrostResistance]: '',
Expand Down
2 changes: 1 addition & 1 deletion ui/core/constants/other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export enum Phase {
Phase5,
}

export const CURRENT_PHASE = Phase.Phase2;
export const CURRENT_PHASE = Phase.Phase1;

export const CURRENT_API_VERSION: number = readMessageOption(ProtoVersion, 'proto.current_version_number')! as number;

Expand Down
25 changes: 11 additions & 14 deletions ui/core/proto_utils/equipped_item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ export class EquippedItem {
});

// Copy the extra socket gem directly.
if (this.couldHaveExtraSocket()) {
newGems.push(this._gems[this._gems.length - 1]);
}
// if (this.couldHaveExtraSocket()) {
// newGems.push(this._gems[this._gems.length - 1]);
// }

return new EquippedItem({
item,
Expand Down Expand Up @@ -322,15 +322,15 @@ export class EquippedItem {
}

requiresExtraSocket(): boolean {
return this.couldHaveExtraSocket() && this.hasExtraGem() && this._gems[this._gems.length - 1] != null;
return false; //this.couldHaveExtraSocket() && this.hasExtraGem() && this._gems[this._gems.length - 1] != null;
}

hasExtraSocket(isBlacksmithing: boolean): boolean {
return isBlacksmithing && this.couldHaveExtraSocket();
return false; //isBlacksmithing && this.couldHaveExtraSocket();
}

numSockets(isBlacksmithing: boolean): number {
return this._item.gemSockets.length + (this.hasExtraSocket(isBlacksmithing) ? 1 : 0);
return this._item.gemSockets.length;
}

numSocketsOfColor(color: GemColor | null): number {
Expand All @@ -356,25 +356,25 @@ export class EquippedItem {
}

hasExtraGem(): boolean {
return this._gems.length > this.item.gemSockets.length;
return false; this._gems.length > this.item.gemSockets.length;
}

hasSocketedGem(socketIdx: number): boolean {
return this._gems[socketIdx] != null;
}

allSocketColors(): Array<GemColor> {
return this.couldHaveExtraSocket() ? this.gemSockets.concat([GemColor.GemColorPrismatic]) : this.gemSockets;
return this._item.gemSockets;
}
curSocketColors(isBlacksmithing: boolean): Array<GemColor> {
return this.hasExtraSocket(isBlacksmithing) ? this.gemSockets.concat([GemColor.GemColorPrismatic]) : this.gemSockets;
return this._item.gemSockets;
}

curGems(isBlacksmithing: boolean): Array<Gem | null> {
return this._gems.slice(0, this.numSockets(isBlacksmithing));
return this._gems;//.slice(0, this.numSockets(isBlacksmithing));
}
curEquippedGems(isBlacksmithing: boolean): Array<Gem> {
return this.curGems(isBlacksmithing).filter(g => g != null) as Array<Gem>;
return this.curGems(true).filter(g => g != null) as Array<Gem>;
}

getProfessionRequirements(): Array<Profession> {
Expand All @@ -390,9 +390,6 @@ export class EquippedItem {
profs.push(gem.requiredProfession);
}
});
if (this.requiresExtraSocket()) {
profs.push(Profession.Blacksmithing);
}
return distinct(profs);
}
getFailedProfessionRequirements(professions: Array<Profession>): Array<Item | Gem | Enchant> {
Expand Down
Loading
Loading