Created Affix, MagicAffix, MagicPrefix and MagicSuffix schemas and table tests

This commit is contained in:
Collin Smith 2021-01-08 01:47:03 -08:00
parent 23449e2ef0
commit d8e78d46cc
5 changed files with 145 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package com.riiablo.table.schema;
import com.riiablo.table.annotation.PrimaryKey;
public class Affix {
@Override
public String toString() {
return name;
}
@PrimaryKey
public String name;
public int version;
public int add;
public int multiply;
public int divide;
}

View File

@ -0,0 +1,21 @@
package com.riiablo.table.schema;
import com.riiablo.table.annotation.Format;
public class MagicAffix extends Affix {
public boolean spawnable;
public boolean rare;
public int level;
public int maxlevel;
public int levelreq;
public String classspecific;
@Format(format = "class")
public String _class;
public int classlevelreq;
public int frequency;
public int group;
public boolean transform;
public String transformcolor;
}

View File

@ -0,0 +1,33 @@
package com.riiablo.table.schema;
import com.riiablo.table.annotation.Schema;
@Schema(
offset = 1
)
public class MagicPrefix extends MagicAffix {
public String mod1code;
public int mod1param;
public int mod1min;
public int mod1max;
public String mod2code;
public int mod2param;
public int mod2min;
public int mod2max;
public String mod3code;
public int mod3param;
public int mod3min;
public int mod3max;
public String itype1;
public String itype2;
public String itype3;
public String itype4;
public String itype5;
public String itype6;
public String itype7;
public String etype1;
public String etype2;
public String etype3;
public String etype4;
public String etype5;
}

View File

@ -0,0 +1,31 @@
package com.riiablo.table.schema;
import com.riiablo.table.annotation.Schema;
@Schema(
offset = 1
)
public class MagicSuffix extends MagicAffix {
public String mod1code;
public int mod1param;
public int mod1min;
public int mod1max;
public String mod2code;
public int mod2param;
public int mod2min;
public int mod2max;
public String mod3code;
public int mod3param;
public int mod3min;
public int mod3max;
public String itype1;
public String itype2;
public String itype3;
public String itype4;
public String itype5;
public String itype6;
public String itype7;
public String etype1;
public String etype2;
public String etype3;
}

View File

@ -14,12 +14,16 @@ import com.riiablo.logger.Level;
import com.riiablo.logger.LogManager;
import com.riiablo.table.schema.BodyLocs;
import com.riiablo.table.schema.ItemStatCost;
import com.riiablo.table.schema.MagicPrefix;
import com.riiablo.table.schema.MagicSuffix;
import com.riiablo.table.schema.MonStats;
import com.riiablo.table.schema.MonStats2;
import com.riiablo.table.schema.Sounds;
import com.riiablo.table.schema.Weapons;
import com.riiablo.table.table.BodyLocsTable;
import com.riiablo.table.table.ItemStatCostTable;
import com.riiablo.table.table.MagicPrefixTable;
import com.riiablo.table.table.MagicSuffixTable;
import com.riiablo.table.table.MonPresetTable;
import com.riiablo.table.table.MonStats2Table;
import com.riiablo.table.table.MonStatsTable;
@ -338,4 +342,42 @@ public class TablesTest extends RiiabloTest {
Assert.assertEquals(452, table.getObjectId(5, 0)); // banner 1
Assert.assertEquals(397, table.getObjectId(5, 149)); // chest
}
@Test
public void magicprefix() {
LogManager.setLevel("com.riiablo.table.table.MagicPrefixTable", Level.TRACE);
TableManifest.magicprefix.parser = null;
FileHandle handle = Gdx.files.internal("test/magicprefix.txt");
MagicPrefixTable table = Tables.loadTsv(TableManifest.magicprefix, handle);
MagicPrefix sturdy = table.get(1);
Assert.assertEquals("STURDY", sturdy.name);
Assert.assertEquals(0, sturdy.version);
Assert.assertEquals(4, sturdy.level);
Assert.assertEquals(3, sturdy.levelreq);
Assert.assertEquals("STURDY", table.get(1).name);
Assert.assertEquals("VICIOUS", table.get(14).name);
Assert.assertEquals("LORD'S", table.get(39).name);
Assert.assertEquals("STALWART", table.get(132).name);
Assert.assertEquals("CRUEL", table.get(668).name);
}
@Test
public void magicsuffix() {
LogManager.setLevel("com.riiablo.table.table.MagicSuffixTable", Level.TRACE);
TableManifest.magicsuffix.parser = null;
FileHandle handle = Gdx.files.internal("test/magicsuffix.txt");
MagicSuffixTable table = Tables.loadTsv(TableManifest.magicsuffix, handle);
MagicSuffix of_health = table.get(0);
Assert.assertEquals("OF HEALTH", of_health.name);
Assert.assertEquals(0, of_health.version);
Assert.assertEquals(7, of_health.level);
Assert.assertEquals(5, of_health.levelreq);
Assert.assertEquals("OF HEALTH", table.get(0).name);
Assert.assertEquals("OF SPIKES", table.get(14).name);
Assert.assertEquals("OF GORE", table.get(39).name);
Assert.assertEquals("OF AMIANTHUS", table.get(132).name);
Assert.assertEquals("OF THE VAMPIRE", table.get(746).name);
}
}