Updated schema definition

This commit is contained in:
2024-12-11 15:40:24 -05:00
parent 5fbb0eac74
commit ef62c10df3

View File

@@ -7,11 +7,19 @@ import (
// Stats enum
const (
STAT_STRENGTH = iota
STAT_INTELLECT = iota
STAT_SPIRIT
STAT_STRENGTH
STAT_AGILITY
STAT_STAMINA
STAT_INTELLECT
STAT_SPIRIT
)
const (
RESIST_FROST = iota
RESIST_FIRE
RESIST_NATURE
RESIST_SHADOW
RESIST_ARCANE
)
func main() {
@@ -25,22 +33,31 @@ func main() {
// Stats names for clarity
stats := map[int]string{
STAT_STRENGTH: "STAT_STRENGTH",
STAT_AGILITY: "STAT_AGILITY",
STAT_STAMINA: "STAT_STAMINA",
STAT_INTELLECT: "STAT_INTELLECT",
STAT_SPIRIT: "STAT_SPIRIT",
STAT_INTELLECT: "Intellect",
STAT_SPIRIT: "Spirit",
STAT_STRENGTH: "Strength",
STAT_AGILITY: "Agility",
STAT_STAMINA: "Stamina",
}
// Start writing the SQL script
fmt.Fprintln(outputFile, "-- SQL Script to Insert 50 Ranks for Each Stat")
fmt.Fprintln(outputFile, "INSERT INTO mp_stat_upgrade_ranks (upgradeRank, statTypeId, materialId1, materialCost, materialId2, materialCost2, materialId3, materialCost3, minIncrease1, maxIncrease1, minIncrease2, maxIncrease2, minIncrease3, maxIncrease3, chanceCost1, chanceCost2, chanceCost3) VALUES")
fmt.Fprintln(outputFile, "INSERT INTO mp_upgrade_ranks (upgradeRank, advancementId, materialId1, materialCost1, materialId2, materialCost2, materialId3, materialCost3, minIncrease1, maxIncrease1, minIncrease2, maxIncrease2, minIncrease3, maxIncrease3, chanceCost1, chanceCost2, chanceCost3) VALUES")
// Iterate over stats
for statID := range stats {
for rank := 1; rank <= 50; rank++ {
// Material cost increases by 50 per rank
materialCost := 100 + (rank-1)*50
materialCost := 50
if rank < 11 {
materialCost = 100 + (rank-1)*50
}
if rank >= 11 && rank < 30 {
materialCost = 500 + (rank-11)*25
}
if rank >= 30 {
materialCost = 1000 + (rank-30)*18
}
// Stat growth
minIncrease1 := 1 + (rank-1)/10*2
@@ -56,10 +73,26 @@ func main() {
chanceCost2 := 50 + (rank-1)*3
chanceCost3 := 75 + (rank-1)*3
// use material ids from the mp_material_types table material1 should be common stuff.
materialId1 := statID*2 + 1
// material2 should be rare stuff only required after rank 10 at growth rate of 5 per rank
materialId2, materialCost2 := 0, 0
if rank > 10 {
materialId2 = statID*2 + 2
materialCost2 = (rank - 11) * 10
}
materialId3, materialCost3 := 0, 0
if rank >= 30 {
materialId3 = 20 // Group lot of raid only items
materialCost3 = (rank - 29) * 3
}
// Write SQL insert statement for this rank
sql := fmt.Sprintf(
"(%d, %d, 1001, %d, 0, 0, 0, 0, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
rank, statID, materialCost,
"(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
rank, statID, materialId1, materialCost, materialId2, materialCost2, materialId3, materialCost3,
minIncrease1, maxIncrease1, minIncrease2, maxIncrease1, minIncrease3, maxIncrease3,
chanceCost1, chanceCost2, chanceCost3,
)