summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2020-08-04 18:54:11 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2020-08-04 18:54:11 -0300
commitfae5ad96f11bfd1d3571ffbeb58db645e7734bed (patch)
tree10ea826446402a2716fe6074906171f8ef8cf201
parenta5da46a5ef196c23e604e3cefeecdead9f939f2d (diff)
Perform some basic ways of grouping outputted affixes
-rw-r--r--data/affix-detals.txt3
-rw-r--r--data/timed-affix-detals.txt3
-rwxr-xr-xgenafx-test.sh2
-rw-r--r--src/main/java/tlIItools/AffixLister.java61
-rw-r--r--src/main/java/tlIItools/AffixSet.java20
5 files changed, 74 insertions, 15 deletions
diff --git a/data/affix-detals.txt b/data/affix-detals.txt
index 961620aa..6f555e7e 100644
--- a/data/affix-detals.txt
+++ b/data/affix-detals.txt
@@ -259,6 +259,9 @@ ADD STAT
CAST SKILL ON DEATH FROM EFFECT OWNER
<1R>%% chance to cast <NME> on kill
+CAST SKILL ON DEATH
+<1R>%% chance to cast <NME> on kill
+
MINIONDAMAGE
<1R>%% <CLM> pet/minion <DT> damage
diff --git a/data/timed-affix-detals.txt b/data/timed-affix-detals.txt
index dc41fcf6..63c41497 100644
--- a/data/timed-affix-detals.txt
+++ b/data/timed-affix-detals.txt
@@ -69,3 +69,6 @@ PERCENT ARMOR BONUS
PERCENT BLOCK CHANCE BASE
<RLM|1|Base Block Chance> for <DUR> seconds
+
+HP MOD OVER TIME
+<RPM|1|HP/Second>
diff --git a/genafx-test.sh b/genafx-test.sh
index 06ee634f..4f9726f9 100755
--- a/genafx-test.sh
+++ b/genafx-test.sh
@@ -5,7 +5,7 @@ set -e
baseout="$1"
shift 1
fileset="$@"
-listopts="-l -z -n named"
+listopts="-z -n named"
outputfle=output/"$baseout".txt
errfle=output/"$baseout".err
outputopts="-o $outputfle -e $errfle"
diff --git a/src/main/java/tlIItools/AffixLister.java b/src/main/java/tlIItools/AffixLister.java
index 1138a7bc..3a096bd2 100644
--- a/src/main/java/tlIItools/AffixLister.java
+++ b/src/main/java/tlIItools/AffixLister.java
@@ -1,15 +1,9 @@
package tlIItools;
-import java.io.IOException;
-import java.io.FileReader;
-import java.io.PrintStream;
+import java.io.*;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.Map.Entry;
-import java.util.Scanner;
-import java.util.Set;
/**
* Lists randomly generated affixes for Torchlight II gear.
@@ -92,6 +86,9 @@ public class AffixLister {
int zeroCount = 0;
int groupCount = 0;
+ boolean outputAffixGroups = false;
+ OutputStream affixGroupDest = null;
+
Map<String, Set<Affix>> groupContents = affixSetByName.affixGroups;
Set<Affix> nonGroupContents = affixSetByName.ungroupedAffixes;
@@ -110,40 +107,49 @@ public class AffixLister {
case "--":
doingArgs = false;
break;
+
case "--omit-zero":
case "-z":
omitZeros = true;
break;
+
case "--no-omit-zero":
case "-Z":
omitZeros = false;
break;
+
case "--list-zero":
case "-l":
listZeros = true;
break;
+
case "--no-list-zero":
case "-L":
listZeros = false;
break;
+
case "--timing":
case "-t":
doTiming = true;
Effect.doTiming = true;
break;
+
case "--no-timing":
case "-T":
doTiming = false;
Effect.doTiming = false;
break;
+
case "--file-names":
case "-f":
addFileName = true;
break;
+
case "--no-file-names":
case "-F":
addFileName = true;
break;
+
case "--name-mode":
case "-n":
if (i + 1 >= args.length) {
@@ -154,6 +160,7 @@ public class AffixLister {
nameMode = NameMode.valueOf(args[++i].toUpperCase());
break;
+
case "--file-group":
case "-g":
if (i + 1 >= args.length) {
@@ -164,14 +171,17 @@ public class AffixLister {
nfr.swapGroup(args[++i]);
break;
+
case "--guess-groups":
nfr.guessGroups = true;
break;
+
case "--no-guess-groups":
nfr.guessGroups = false;
break;
+
case "--read-names-from-file":
case "-r":
if (i + 1 >= args.length) {
@@ -182,6 +192,7 @@ public class AffixLister {
nfr.readFrom(args[++i]);
break;
+
case "--output":
case "-o":
if (i + 1 >= args.length) {
@@ -200,6 +211,7 @@ public class AffixLister {
}
break;
+
case "--output-errors":
case "-e":
if (i + 1 >= args.length) {
@@ -218,6 +230,7 @@ public class AffixLister {
}
break;
+
case "--guess-regex":
if (i + 1 >= args.length) {
errOut.printf("ERROR: group regex argument requires the regex to use be specified\n");
@@ -227,6 +240,21 @@ public class AffixLister {
nfr.groupRx = args[++i];
break;
+ case "--output-affix-groups":
+ if (i + 1 >= args.length) {
+ errOut.printf("ERROR: to output affix-groups, must specify a file to output them to");
+ break;
+ }
+
+ try {
+ affixGroupDest = new PrintStream(args[++i]);
+
+ outputAffixGroups = true;
+ } catch (IOException ioex) {
+ errOut.printf("ERROR: Couldn't open file %s to write affix groups to\n", affixGroupDest);
+ }
+
+ break;
default:
isArg = false;
}
@@ -312,6 +340,23 @@ public class AffixLister {
errOut.println();
errOut.println();
+ if (outputAffixGroups) {
+ for (Entry<String, Set<Affix>> ent : affixSetByContents.affixGroups.entrySet()) {
+ String groupName = ent.getKey();
+ Set<Affix> affixes = ent.getValue();
+
+ boolean isFirstAfx = true;
+ for (Affix afx : affixes) {
+ if (isFirstAfx) {
+ // Print the header for this
+ // group
+ isFirstAfx = false;
+ }
+ // print this affix in the group format
+ }
+ }
+ }
+
long endTime = System.nanoTime();
errOut.printf("\nProcessed %,d affixes (%,d named, %,d unnamed, %,d zero-weight) (%,d effects) (%,d distinct groups, %,d actual groups, %,d nongrouped affixes) out of %,d files (%,d groups) in %,d nanoseconds (%.2f seconds)\n", nfr.fCount, namedCount, unnamedCount, zeroCount, effectCount, groupCount, groupContents.size(), nonGroupContents.size(), nfr.fCount, nfr.fNames.size(), endTime - startTime, ((double)(endTime - startTime) / 1000000000));
errOut.printf("\tOptions: Name Mode: %s, Special-case zero weight: %s, Noting zero-weight in special case: %s\n", nameMode, !listZeros, !omitZeros);
diff --git a/src/main/java/tlIItools/AffixSet.java b/src/main/java/tlIItools/AffixSet.java
index 569649ec..d7f14211 100644
--- a/src/main/java/tlIItools/AffixSet.java
+++ b/src/main/java/tlIItools/AffixSet.java
@@ -1,15 +1,23 @@
package tlIItools;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
+
/**
* Container of a set of affixes.
*
* @author Ben Culkin
*/
public class AffixSet {
+ private static class AffixComparator implements Comparator<Affix> {
+ public int compare(Affix a1, Affix a2) {
+ if (a1.minLevel == a2.minLevel) {
+ return a1.maxLevel - a2.maxLevel;
+ }
+
+ return a1.minLevel - a2.minLevel;
+ }
+ }
+
/**
* All of the affix groups contained in this set.
*
@@ -27,9 +35,9 @@ public class AffixSet {
* Create a new blank affix set.
*/
public AffixSet() {
- affixGroups = new HashMap<>();
+ affixGroups = new TreeMap<>();
- ungroupedAffixes = new HashSet<>();
+ ungroupedAffixes = new TreeSet<>(new AffixComparator());
}
/**