mirror of
https://github.com/araxiaonline/wow-item-generator.git
synced 2026-06-13 03:02:22 -04:00
scaling is working now and main is scaling first 600 items
This commit is contained in:
BIN
data/items.db
BIN
data/items.db
Binary file not shown.
@@ -89,7 +89,7 @@ func (db *MySqlDb) GetBossLoot(bossId int) ([]DbItem, error) {
|
||||
SELECT ` + GetItemFields("it") + `
|
||||
FROM acore_world.reference_loot_template rlt
|
||||
JOIN acore_world.item_template it ON rlt.Item = it.entry
|
||||
WHERE rlt.Entry = ? and it.Quality > 2 and it.StatsCount > 0
|
||||
WHERE rlt.Entry = ? and it.Quality > 2
|
||||
`
|
||||
err = db.Select(&refItems, sql, ref)
|
||||
if err != nil {
|
||||
|
||||
@@ -380,7 +380,7 @@ func TestScaleDPS(t *testing.T) {
|
||||
// Seed the random number generator for consistent test results
|
||||
rand.Seed(1)
|
||||
|
||||
gotDPS, err := tt.item.ScaleDPS(tt.level)
|
||||
gotDPS, err := tt.item.ScaleDPS(tt.level, 100)
|
||||
if (err != nil) != tt.expectError {
|
||||
t.Errorf("ScaleDPS() error = %v, expectError %v", err, tt.expectError)
|
||||
return
|
||||
|
||||
@@ -200,12 +200,13 @@ func (item Item) GetDPS() (float64, error) {
|
||||
return 0, fmt.Errorf("delay is not set")
|
||||
}
|
||||
|
||||
dps := math.Round((float64(*item.MinDmg1+*item.MaxDmg1)/2.0)/float64(*item.Delay/1000)*100) / 100
|
||||
dps := math.Round(((float64(*item.MinDmg1)+float64(*item.MaxDmg1))/2.0)/(float64(*item.Delay)/1000.0)*100) / 100
|
||||
|
||||
return dps, nil
|
||||
}
|
||||
|
||||
// Scales and items dps damage numbers based on a desired item level.
|
||||
func (item *Item) ScaleDPS(level int) (float64, error) {
|
||||
func (item *Item) ScaleDPS(oldLevel, level int) (float64, error) {
|
||||
if item.ItemLevel == nil {
|
||||
return 0, fmt.Errorf("ItemLevel is not set")
|
||||
}
|
||||
@@ -220,13 +221,18 @@ func (item *Item) ScaleDPS(level int) (float64, error) {
|
||||
return 0.0, err
|
||||
}
|
||||
|
||||
dps := modifier * float64(level)
|
||||
scalingFactor := math.Pow(float64(level)/float64(oldLevel), 1.1)
|
||||
|
||||
dps := modifier * float64(level) * scalingFactor
|
||||
adjDps := (dps * (*item.Delay / 1000) / 100)
|
||||
|
||||
//(((Y8*Y4)/100))*((100 - Y5)) Forumula from Weapon Item Genertor
|
||||
minimum := adjDps * float64(100-(rand.IntN(17)+20))
|
||||
minimum := adjDps * float64(100-(rand.IntN(25)+22))
|
||||
maximum := adjDps * float64(100+(rand.IntN(25)+28))
|
||||
|
||||
minimum = math.Ceil(minimum)
|
||||
maximum = math.Ceil(maximum)
|
||||
|
||||
// If the weapon has secondary damage, scale that as well based on the ratio of the primary damage
|
||||
if *item.MinDmg2 != 0 && *item.MaxDmg2 != 0 {
|
||||
ratioMin := float64(*item.MinDmg2) / float64(*item.MinDmg1)
|
||||
@@ -505,7 +511,7 @@ func (item *Item) ScaleItem(itemLevel int, itemQuality int) (bool, error) {
|
||||
log.Printf("Failed to get DPS: %v", err)
|
||||
}
|
||||
|
||||
dps, err := item.ScaleDPS(itemLevel)
|
||||
dps, err := item.ScaleDPS(fromItemLevel, itemLevel)
|
||||
if err != nil {
|
||||
log.Printf("Failed to scale DPS: %v", err)
|
||||
return false, err
|
||||
@@ -737,12 +743,18 @@ func scaleStatv3(scaleParams StatScaleParams) int {
|
||||
|
||||
func ItemToSql(item Item, reqLevel int, difficulty int) string {
|
||||
|
||||
var name string
|
||||
|
||||
entryBump := 20000000
|
||||
spellBump := 30000000
|
||||
name = "Mythic " + item.Name
|
||||
|
||||
if difficulty == 4 {
|
||||
entryBump = 21000000
|
||||
name = "Legendary " + item.Name
|
||||
}
|
||||
if difficulty == 5 {
|
||||
name = "Godlike " + item.Name
|
||||
entryBump = 22000000
|
||||
}
|
||||
|
||||
@@ -816,6 +828,7 @@ func ItemToSql(item Item, reqLevel int, difficulty int) string {
|
||||
UPDATE acore_world.item_template
|
||||
SET
|
||||
Quality = %v,
|
||||
name = '%s',
|
||||
ItemLevel = %v,
|
||||
RequiredLevel = %v,
|
||||
dmg_min1 = %v,
|
||||
@@ -859,7 +872,7 @@ func ItemToSql(item Item, reqLevel int, difficulty int) string {
|
||||
SellPrice = FLOOR(100000 + (RAND() * 400001)),
|
||||
Armor = %v
|
||||
WHERE entry = %v;
|
||||
`, *item.Quality, *item.ItemLevel, reqLevel, *item.MinDmg1, *item.MaxDmg1, *item.MinDmg2, *item.MaxDmg2, *item.StatsCount,
|
||||
`, *item.Quality, name, *item.ItemLevel, reqLevel, *item.MinDmg1, *item.MaxDmg1, *item.MinDmg2, *item.MaxDmg2, *item.StatsCount,
|
||||
*item.StatType1, *item.StatValue1, *item.StatType2, *item.StatValue2, *item.StatType3, *item.StatValue3, *item.StatType4, *item.StatValue4,
|
||||
*item.StatType5, *item.StatValue5, *item.StatType6, *item.StatValue6, *item.StatType7, *item.StatValue7, *item.StatType8, *item.StatValue8,
|
||||
*item.StatType9, *item.StatValue9, *item.StatType10, *item.StatValue10, *item.SpellId1, *item.SpellId2, *item.SpellId3, *item.SocketColor1, *item.SocketContent1,
|
||||
|
||||
13
main.go
13
main.go
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
@@ -100,16 +101,18 @@ func main() {
|
||||
}
|
||||
|
||||
// Print all the status for the item that was copied
|
||||
log.Printf("Item Name: %v Stat1: %v Stat2: %v Stat3: %v Stat4: %v Stat5: %v Stat6: %v Stat7: %v Stat8: %v \n",
|
||||
item.Entry, *item.StatValue1, *item.StatValue2, *item.StatValue3, *item.StatValue4, *item.StatValue5, *item.StatValue6, *item.StatValue7, *item.StatValue8)
|
||||
// log.Printf("Item Name: %v Stat1: %v Stat2: %v Stat3: %v Stat4: %v Stat5: %v Stat6: %v Stat7: %v Stat8: %v \n",
|
||||
// item.Entry, *item.StatValue1, *item.StatValue2, *item.StatValue3, *item.StatValue4, *item.StatValue5, *item.StatValue6, *item.StatValue7, *item.StatValue8)
|
||||
|
||||
item.ApplyStats(items.ItemFromDbItem(highLevelItem))
|
||||
|
||||
item.ScaleItem(*itemLevel, 3)
|
||||
log.Printf("Item Name: %v Stat1: %v Stat2: %v Stat3: %v Stat4: %v Stat5: %v Stat6: %v Stat7: %v Stat8: %v \n",
|
||||
item.Name, *item.StatValue1, *item.StatValue2, *item.StatValue3, *item.StatValue4, *item.StatValue5, *item.StatValue6, *item.StatValue7, *item.StatValue8)
|
||||
// log.Printf("Item Name: %v Stat1: %v Stat2: %v Stat3: %v Stat4: %v Stat5: %v Stat6: %v Stat7: %v Stat8: %v \n",
|
||||
// item.Name, *item.StatValue1, *item.StatValue2, *item.StatValue3, *item.StatValue4, *item.StatValue5, *item.StatValue6, *item.StatValue7, *item.StatValue8)
|
||||
|
||||
if itr > 100 {
|
||||
fmt.Print(items.ItemToSql(item, 80, 3))
|
||||
|
||||
if itr > 600 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user