Created CharStats schema and tests

This commit is contained in:
Collin Smith 2021-01-08 19:03:50 -08:00
parent 367b0835a6
commit a2ca786ff6
2 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,71 @@
package com.riiablo.table.schema;
import com.riiablo.table.annotation.Format;
import com.riiablo.table.annotation.Schema;
@Schema
public class CharStats {
@Override
public String toString() {
return _class;
}
@Format(format = "class")
public String _class;
public int str;
public int dex;
@Format(format = "int")
public int _int;
public int vit;
public int stamina;
public int hpadd;
public int ManaRegen;
public int ToHitFactor;
public int WalkVelocity;
public int RunVelocity;
public int RunDrain;
public int LifePerLevel;
public int StaminaPerLevel;
public int ManaPerLevel;
public int LifePerVitality;
public int StaminaPerVitality;
public int ManaPerMagic;
public int StatPerLevel;
public int BlockFactor;
public String StrAllSkills;
@Format(
startIndex = 1,
endIndex = 4)
public String StrSkillTab[];
public String StrClassOnly;
public String baseWClass;
@Format(
format = "Skill %d",
startIndex = 1,
endIndex = 11)
public String Skill[];
@Format(
format = "item%d",
startIndex = 1,
endIndex = 11)
public String item[];
@Format(
format = "item%dloc",
startIndex = 1,
endIndex = 11)
public String itemloc[];
@Format(
format = "item%dcount",
startIndex = 1,
endIndex = 11)
public String itemcount[];
}

View File

@ -8,6 +8,7 @@ import org.junit.Test;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.riiablo.Riiablo;
import com.riiablo.RiiabloTest;
import com.riiablo.attributes.Stat;
import com.riiablo.logger.Level;
@ -24,6 +25,7 @@ import com.riiablo.table.schema.Sounds;
import com.riiablo.table.schema.Weapons;
import com.riiablo.table.table.ArmTypeTable;
import com.riiablo.table.table.BodyLocsTable;
import com.riiablo.table.table.CharStatsTable;
import com.riiablo.table.table.ItemStatCostTable;
import com.riiablo.table.table.MagicPrefixTable;
import com.riiablo.table.table.MagicSuffixTable;
@ -437,4 +439,26 @@ public class TablesTest extends RiiabloTest {
Assert.assertEquals("MED", table.get(1).Token);
Assert.assertEquals("HVY", table.get(2).Token);
}
@Test
public void charstats() {
LogManager.setLevel("com.riiablo.table.table.CharStatsTable", Level.TRACE);
TableManifest.charstats.parser = null;
FileHandle handle = Gdx.files.internal("test/charstats.txt");
CharStatsTable table = Tables.loadTsv(TableManifest.charstats, handle);
Assert.assertEquals("AMAZON", table.get(Riiablo.AMAZON)._class);
Assert.assertEquals(20, table.get(Riiablo.AMAZON).str);
Assert.assertEquals("SORCERESS", table.get(Riiablo.SORCERESS)._class);
Assert.assertEquals(10, table.get(Riiablo.SORCERESS).str);
Assert.assertEquals("NECROMANCER", table.get(Riiablo.NECROMANCER)._class);
Assert.assertEquals(15, table.get(Riiablo.NECROMANCER).str);
Assert.assertEquals("PALADIN", table.get(Riiablo.PALADIN)._class);
Assert.assertEquals(25, table.get(Riiablo.PALADIN).str);
Assert.assertEquals("BARBARIAN", table.get(Riiablo.BARBARIAN)._class);
Assert.assertEquals(30, table.get(Riiablo.BARBARIAN).str);
Assert.assertEquals("DRUID", table.get(Riiablo.DRUID)._class);
Assert.assertEquals(15, table.get(Riiablo.DRUID).str);
Assert.assertEquals("ASSASSIN", table.get(Riiablo.ASSASSIN)._class);
Assert.assertEquals(20, table.get(Riiablo.ASSASSIN).str);
}
}