Skip to content

Commit b92feab

Browse files
Merge branch 'obc/scorer-generator' into ok/obc-alpha-release
2 parents 31ca52c + 3a88041 commit b92feab

File tree

11 files changed

+42
-43
lines changed

11 files changed

+42
-43
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ The mod config is located in `cfg.json`. You can change this config to your lik
9090
* Removes attribute requirements from items.
9191
#### RemoveUniqCharmLimit `bool`
9292
* Allows to carry more than 1 unique charm of the same type.
93-
#### PerfectProps `bool`
94-
* All props will have the max value for min/max values
9593
#### UseOSkills `bool`
9694
* Will change class only skills to oskills
95+
#### PerfectProps `bool`
96+
* All props will have the max value for min/max values
9797
#### EnterToExit `bool`
9898
* If this is true, this will require the user to press enter to close the program
9999
* If false, it will not prompt user input
@@ -202,6 +202,9 @@ Anyone who donates, will get recognition in the form of a role in the Discord.
202202
Thanks!
203203

204204
# Change Log
205+
## v0.5.2-alpha-20
206+
* Set Generator default to false to work around the ui bug.
207+
* Fix for PerfectProps doing "r=" proptypes
205208
## v0.5.2-alpha-19
206209
* Set PropScoreMultiplier to 1 if user had set it to 0 (thx Speculator)
207210
* Fix Seeds.txt code to write correct seed, and in addition write SetsSeed.
@@ -330,3 +333,8 @@ Thanks!
330333

331334
# Credits
332335
* [Dead Weight Design](https://www.instagram.com/deadweightdesign/) - Thanks for creating the logo!
336+
* tlentz, Deadlock39, OldBeardedCoder/EMPY -- Teh Devs
337+
* Amek for being the true moderating god he is and for his awesome tutorials and cat herding.
338+
* iksargodzilla - Thank-you so much for doing 90% of the grunt work for the scoring engine
339+
* macohan, Negative Inspiration, for helping with design and being a huge help with the newbies.
340+
* The many others that reported bugs, proposed enhancements and gave moral support & encouragement.

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.5.2-alpha-19
1+
v0.5.2-alpha-20

cfg.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "v0.5.2-alpha-19",
2+
"Version": "v0.5.2-alpha-20",
33
"SourceDir": "",
44
"OutputDir": "",
55
"MeleeSplash": true,
@@ -37,7 +37,7 @@
3737
"ElementalSkills": true
3838
},
3939
"GeneratorOptions": {
40-
"Generate": true,
40+
"Generate": false,
4141
"UseSeed": true,
4242
"Seed": 1234,
4343
"UseSetsSeed": true,

gui/react-ui/src/components/D2ModMaker/Main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const _ = require('lodash');
2121
const axios = require("axios");
2222

2323
const defaultCfg = {
24-
Version: "v0.5.2-alpha-19",
24+
Version: "v0.5.2-alpha-20",
2525
SourceDir: "",
2626
OutputDir: "",
2727
MeleeSplash: true,
@@ -39,8 +39,8 @@ const defaultCfg = {
3939
RemoveLevelRequirements: false,
4040
RemoveAttRequirements: false,
4141
RemoveUniqCharmLimit: false,
42-
PerfectProps: false,
4342
UseOSkills: true,
43+
PerfectProps: false,
4444
SafeUnsocket: true,
4545
PropDebug: false,
4646
EnterToExit: false,
@@ -59,7 +59,7 @@ const defaultCfg = {
5959
ElementalSkills: true
6060
},
6161
GeneratorOptions: {
62-
Generate: true,
62+
Generate: false,
6363
UseSeed: false,
6464
Seed: -1,
6565
UseSetsSeed: true,

internal/d2fs/assets/assets_vfsdata.go

Lines changed: 4 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/d2fs/d2fs.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func NewFiles(sourceDir string, outDir string) Files {
5252
if (sourceDir == outDir) && (sourceDir != "") {
5353
log.Fatalf("Error: Source Directory == Output Directory. Either set the Source Directory to blank (to use 1.13c default files), or set it to vanilla data/ directory. OutDir is deleted and re-created each run")
5454
}
55-
//os.RemoveAll(path.Join(files.outDir, "/data/")) // obc: This is c4 approach, use sword instead
55+
//os.RemoveAll(path.Join(files.outDir, "/data/")) // obc: This is the old c4 approach, use sword instead
5656
err := os.MkdirAll(path.Join(files.outDir, assets.DataGlobalExcel), 0755)
5757
util.Check(err)
5858

@@ -74,10 +74,8 @@ func NewFiles(sourceDir string, outDir string) Files {
7474
// ReadD2File reads a given d2 file
7575
func (d2files *Files) Read(filepath string, filename string) *File {
7676
if d2files.sourceDir == "" {
77-
// open csvfile
78-
//fmt.Printf("Opening %s %s\n", filepath, filename)
77+
// open tsvfile
7978
csvfile, err := assets.Assets.Open(path.Join(filepath, filename))
80-
//TODO: figure out how to move this out of if/else
8179
checkError(filename, err)
8280
defer csvfile.Close()
8381
return importCsv(csvfile, filename)
@@ -91,14 +89,15 @@ func (d2files *Files) Read(filepath string, filename string) *File {
9189

9290
// ReadAsset Reads in a tsv file from vfs but doesn't cache it in Files
9391
func ReadAsset(filePath string, filename string) *File {
94-
// open csvfile
92+
// open tsvfile
9593
csvfile, err := assets.Assets.Open(path.Join(filePath, filename))
9694
checkError(filename, err)
9795
defer csvfile.Close()
9896

9997
return importCsv(csvfile, filename)
10098
}
10199

100+
// importCsv This is actually tab separated value, i.e. tsv
102101
func importCsv(csvfile io.Reader, filename string) *File {
103102
// create new D2File pointer with fname
104103
d2file := &File{FileName: filename}
@@ -197,21 +196,20 @@ func MergeRows(f1 *File, f2 File) {
197196

198197
keys[f1.Rows[rowIdx][0]] = rowIdx
199198
}
200-
//fmt.Printf("%v", keys)
201199
for f2RowIdx := range f2.Rows {
202200
f1RowIdx, ok := keys[f2.Rows[f2RowIdx][0]]
203201
if ok {
204202
f1.Rows[f1RowIdx] = f2.Rows[f2RowIdx]
205203
//fmt.Printf("Merging...%s\n", f2.Rows[f2RowIdx][0])
206204
} else {
207-
//fmt.Printf("Len Before:%d\n", len(f1.Rows))
208205
f1.Rows = append(f1.Rows, f2.Rows[f2RowIdx])
209-
//fmt.Printf("Len After :%d\n", len(f1.Rows))
210206
}
211207
}
212208
}
213209

214-
//func printFile() {
210+
// This function will generate a list of constants from a header.
211+
// Useful when creating a new internal\txt\blah\blah.go file
212+
//func printFileHeader() {
215213
// d2files := d2file.D2Files{}
216214
// f := d2file.GetOrCreateFile(d2files, magicSuffix.FileName)
217215
// for i := range f.Headers {
@@ -220,7 +218,7 @@ func MergeRows(f1 *File, f2 File) {
220218
// panic("")
221219
//}
222220

223-
// DebugDumpFiles Dump all of Files to console
224-
func DebugDumpFiles(f Files, filename string) {
221+
// DebugDumpVFSFileNames Dump all of Files to console
222+
func DebugDumpVFSFileNames(f Files, filename string) {
225223
fmt.Printf("%s\n", f.cache[filename])
226224
}

internal/d2mod/config/cfg.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ type Data struct {
5757
RemoveLevelRequirements bool `json:"RemoveLevelRequirements"`
5858
RemoveAttRequirements bool `json:"RemoveAttRequirements"`
5959
RemoveUniqCharmLimit bool `json:"RemoveUniqCharmLimit"`
60-
PerfectProps bool `json:"PerfectProps"` // sets min/max to max
6160
UseOSkills bool `json:"UseOSkills"` // +3 Fireball (Sorceress Only) -> +3 Fireball
61+
PerfectProps bool `json:"PerfectProps"` // sets min/max to max
6262
SafeUnsocket bool `json:"SafeUnsocket"`
6363
PropDebug bool `json:"PropDebug"`
6464
EnterToExit bool `json:"EnterToExit"`
@@ -69,7 +69,7 @@ type Data struct {
6969
// DefaultData Default configuration should the cfg.json not read/be missing anything.
7070
func DefaultData() Data {
7171
return Data{
72-
Version: "v0.5.2-alpha-19",
72+
Version: "v0.5.2-alpha-20",
7373
SourceDir: "",
7474
OutputDir: "",
7575
MeleeSplash: true,
@@ -87,8 +87,8 @@ func DefaultData() Data {
8787
RemoveLevelRequirements: false,
8888
RemoveAttRequirements: false,
8989
RemoveUniqCharmLimit: false,
90-
PerfectProps: false,
9190
UseOSkills: true,
91+
PerfectProps: false,
9292
SafeUnsocket: true,
9393
PropDebug: false,
9494
EnterToExit: false,
@@ -107,7 +107,7 @@ func DefaultData() Data {
107107
ElementalSkills: true,
108108
},
109109
GeneratorOptions: GeneratorOptions{
110-
Generate: true,
110+
Generate: false,
111111
UseSeed: false,
112112
Seed: -1,
113113
UseSetsSeed: true,

internal/d2mod/elementalskills/elementalskills.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/tlentz/d2modmaker/internal/d2fs/txts/itemStatCost"
1111
"github.com/tlentz/d2modmaker/internal/d2fs/txts/properties"
1212
"github.com/tlentz/d2modmaker/internal/d2fs/txts/propscores"
13-
"github.com/tlentz/d2modmaker/internal/d2mod/d2items"
1413
"github.com/tlentz/d2modmaker/internal/d2mod/prop"
1514
"github.com/tlentz/d2modmaker/internal/d2mod/scorer/scorerstatistics"
1615
"github.com/tlentz/d2modmaker/internal/util"
@@ -45,7 +44,7 @@ func Run(outDir string, d2files d2fs.Files, enabled bool) {
4544
}
4645
}
4746

48-
// SetProbability Increase probability of getting the other elementalskills to match fireskills
47+
// SetProbability Increase probability of getting the other elementalskills to match fireskills in the Generator
4948
func SetProbability(d2files d2fs.Files, ss *scorerstatistics.ScorerStatistics, enabled bool) {
5049
if enabled {
5150
fireSkillsRows := make(map[int]bool, 0)
@@ -99,9 +98,9 @@ func copyPatchString(outDir string) {
9998
util.Check(err)
10099
}
101100

102-
// Props Add elemental skill props to a list of props
103-
func Props() d2items.Props {
104-
props := make(d2items.Props, 4)
101+
// Props Add elemental skill props to a list of props. (Randomizer)
102+
func Props() prop.Props {
103+
props := make(prop.Props, 4)
105104
props[0] = prop.NewProp("coldskill", "", "1", "4", 0)
106105
props[1] = prop.NewProp("poisonskill", "", "1", "4", 0)
107106
props[2] = prop.NewProp("lightningskill", "", "1", "4", 0)

internal/d2mod/perfectprops/perfectprops.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func convertFile(d2files *d2fs.Files, pmap propName2PropParType, ifi *d2fs.ItemF
3535
propName := file.Rows[rowIdx][colIdx]
3636
parType := pmap[propName]
3737
switch {
38-
case (parType == "r") || (parType == "rp") || (parType == "rt") || (parType == "smm"):
38+
case (parType == "r") || (parType == "rp") || (parType == "rt") || (parType == "smm") || (parType == "r="):
3939
if file.Rows[rowIdx][colIdx+2] == file.Rows[rowIdx][colIdx+3] {
4040
conversionCounter++
4141
}

internal/d2mod/runewordlevels/runewordlevels.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package runewordlevels
22

33
import (
44
"fmt"
5+
"log"
56
"strconv"
67

78
"github.com/tlentz/d2modmaker/internal/d2fs"
@@ -13,8 +14,7 @@ var miscItemLevelsCache map[string]int // OBC: yeah ok it's static variable, thr
1314

1415
func GetRunewordLevel(row []string, miscItemLevels map[string]int) int {
1516
if len(miscItemLevels) == 0 {
16-
fmt.Printf("runewordlevels was not initialized before calling GetRunewordLevel\n")
17-
panic(1)
17+
log.Panicf("runewordlevels was not initialized before calling GetRunewordLevel\n")
1818
}
1919
rl := 0
2020
for j := 0; j < 6; j++ {
@@ -46,9 +46,9 @@ func GetMiscItemLevels(d2files *d2fs.Files) map[string]int {
4646
fmt.Printf("%s\n", row)
4747
if row[misc.Code][0] == 'r' {
4848
fmt.Printf("GetMiscItemLevels Row:%s\n", row[misc.Code])
49-
d2fs.DebugDumpFiles(*d2files, misc.FileName)
49+
d2fs.DebugDumpVFSFileNames(*d2files, misc.FileName)
5050

51-
panic(3)
51+
log.Panicf("MicItems.txt Level column is not numeric")
5252
}
5353
}
5454
}

0 commit comments

Comments
 (0)