Added class only string to item label

This commit is contained in:
Collin Smith 2019-03-23 04:01:37 -07:00
parent 43e6eae12a
commit 376c574dd8
2 changed files with 17 additions and 0 deletions

View File

@ -146,4 +146,17 @@ public enum CharacterClass {
default: throw new GdxRuntimeException("Invalid class id: " + classId);
}
}
public static CharacterClass get(String charClass) {
if (charClass == null || charClass.length() < 3) throw new GdxRuntimeException("Invalid class id: " + charClass);
switch (charClass.charAt(0)) {
case 'a': return charClass.charAt(1) == 'm' ? CharacterClass.AMAZON : CharacterClass.ASSASSIN;
case 'b': return CharacterClass.BARBARIAN;
case 'd': return CharacterClass.DRUID;
case 'n': return CharacterClass.NECROMANCER;
case 'p': return CharacterClass.PALADIN;
case 's': return CharacterClass.SORCERESS;
default: throw new GdxRuntimeException("Invalid class id: " + charClass);
}
}
}

View File

@ -14,6 +14,7 @@ import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.IntMap;
import com.badlogic.gdx.utils.IntSet;
import com.badlogic.gdx.utils.ObjectMap;
import com.riiablo.CharacterClass;
import com.riiablo.Riiablo;
import com.riiablo.codec.DC6;
import com.riiablo.codec.Index;
@ -890,6 +891,9 @@ public class Item extends Actor implements Disposable {
}
if (!Item.this.base.nodurability && (stat = stats.get(Stat.durability)) != null)
add(new Label(Riiablo.string.lookup("ItemStats1d") + " " + stat.value + " " + Riiablo.string.lookup("ItemStats1j") + " " + stats.get(Stat.maxdurability).value, font, Riiablo.colors.white)).center().space(SPACING).row();
if (Item.this.type.is("clas")) {
add(new Label(Riiablo.string.lookup(CharacterClass.get(Item.this.type.Class).entry().StrClassOnly), font, Riiablo.colors.white)).center().space(SPACING).row();
}
if ((stat = stats.get(Stat.dexterity)) != null && stat.value > 0)
add(new Label(Riiablo.string.lookup("ItemStats1f") + " " + stat.value, font, Riiablo.colors.white)).center().space(SPACING).row();
if ((stat = stats.get(Stat.strength)) != null && stat.value > 0)