mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-08 23:07:46 +07:00
Added item stat name format support for most stats
Added item stat name format support for most stats Added CharStats excel Added CharStats.Entry retrieval from CharacterClass Fixed bug when retrieving class id from skill without a class Added classId and CharacterClass lookups from Skills excel
This commit is contained in:
@ -2,6 +2,7 @@ package com.riiablo;
|
||||
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
|
||||
import com.riiablo.codec.excel.CharStats;
|
||||
import com.riiablo.graphics.BlendMode;
|
||||
|
||||
public enum CharacterClass {
|
||||
@ -129,6 +130,10 @@ public enum CharacterClass {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public CharStats.Entry entry() {
|
||||
return Riiablo.files.CharStats.get(id);
|
||||
}
|
||||
|
||||
public static CharacterClass get(int classId) {
|
||||
switch (classId) {
|
||||
case 0: return AMAZON;
|
||||
|
@ -8,6 +8,7 @@ import com.riiablo.codec.TXT;
|
||||
import com.riiablo.codec.excel.ArmType;
|
||||
import com.riiablo.codec.excel.Armor;
|
||||
import com.riiablo.codec.excel.BodyLocs;
|
||||
import com.riiablo.codec.excel.CharStats;
|
||||
import com.riiablo.codec.excel.Colors;
|
||||
import com.riiablo.codec.excel.CompCode;
|
||||
import com.riiablo.codec.excel.Composit;
|
||||
@ -52,6 +53,7 @@ public class Files {
|
||||
public final Armor armor;
|
||||
public final ArmType ArmType;
|
||||
public final BodyLocs bodylocs;
|
||||
public final CharStats CharStats;
|
||||
public final Colors colors;
|
||||
public final Composit Composit;
|
||||
public final CompCode compcode;
|
||||
@ -95,6 +97,7 @@ public class Files {
|
||||
armor = load(assets, Armor.class);
|
||||
ArmType = load(assets, ArmType.class);
|
||||
bodylocs = load(assets, BodyLocs.class);
|
||||
CharStats = load(assets, CharStats.class, Excel.EXPANSION);
|
||||
colors = load(assets, Colors.class);
|
||||
Composit = load(assets, Composit.class);
|
||||
compcode = load(assets, CompCode.class);
|
||||
|
25
core/src/com/riiablo/codec/excel/CharStats.java
Normal file
25
core/src/com/riiablo/codec/excel/CharStats.java
Normal file
@ -0,0 +1,25 @@
|
||||
package com.riiablo.codec.excel;
|
||||
|
||||
public class CharStats extends Excel<CharStats.Entry> {
|
||||
public static class Entry extends Excel.Entry {
|
||||
@Override
|
||||
public String toString() {
|
||||
return _class;
|
||||
}
|
||||
|
||||
@Key
|
||||
@Column(format = "class")
|
||||
public String _class;
|
||||
@Column public int str;
|
||||
@Column public int dex;
|
||||
@Column(format = "int")
|
||||
public int _int;
|
||||
@Column public int vit;
|
||||
@Column public int WalkVelocity;
|
||||
@Column public int RunVelocity;
|
||||
@Column public String StrAllSkills;
|
||||
@Column(startIndex = 1, endIndex = 4)
|
||||
public String StrSkillTab[];
|
||||
@Column public String StrClassOnly;
|
||||
}
|
||||
}
|
@ -1,6 +1,26 @@
|
||||
package com.riiablo.codec.excel;
|
||||
|
||||
import com.riiablo.CharacterClass;
|
||||
|
||||
public class Skills extends Excel<Skills.Entry> {
|
||||
public static int getClassId(String charClass) {
|
||||
if (charClass.isEmpty()) return -1;
|
||||
switch (charClass.charAt(0)) {
|
||||
case 'a': return charClass.charAt(1) == 'm' ? CharacterClass.AMAZON.id : CharacterClass.ASSASSIN.id;
|
||||
case 'b': return CharacterClass.BARBARIAN.id;
|
||||
case 'd': return CharacterClass.DRUID.id;
|
||||
case 'n': return CharacterClass.NECROMANCER.id;
|
||||
case 'p': return CharacterClass.PALADIN.id;
|
||||
case 's': return CharacterClass.SORCERESS.id;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static CharacterClass getClass(String charClass) {
|
||||
int classId = getClassId(charClass);
|
||||
return classId != -1 ? CharacterClass.get(classId) : null;
|
||||
}
|
||||
|
||||
public static class Entry extends Excel.Entry {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -788,7 +788,7 @@ public class Item extends Actor implements Disposable {
|
||||
});
|
||||
|
||||
for (Stat.Instance stat : stats) {
|
||||
Label label = new Label(stat.stat + ": " + stat, font);
|
||||
Label label = new Label(stat.format(), font);
|
||||
add(label).center().space(SPACING).row();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,11 @@
|
||||
package com.riiablo.item;
|
||||
|
||||
import com.riiablo.CharacterClass;
|
||||
import com.riiablo.Riiablo;
|
||||
import com.riiablo.codec.excel.CharStats;
|
||||
import com.riiablo.codec.excel.ItemStatCost;
|
||||
import com.riiablo.codec.excel.SkillDesc;
|
||||
import com.riiablo.codec.excel.Skills;
|
||||
import com.riiablo.codec.util.BitStream;
|
||||
|
||||
public enum Stat {
|
||||
@ -420,6 +424,60 @@ public enum Stat {
|
||||
this.param = param;
|
||||
}
|
||||
|
||||
public String format() {
|
||||
CharStats.Entry entry;
|
||||
Skills.Entry skill;
|
||||
SkillDesc.Entry desc;
|
||||
switch (stat.entry.descfunc) {
|
||||
case 1: return String.format("+%d %s", value, descstr());
|
||||
case 2: return String.format("%d%% %s", value, descstr());
|
||||
case 3: return String.format("%d %s", value, descstr());
|
||||
case 4: return String.format("+%d%% %s", value, descstr());
|
||||
case 5: return String.format("%d%% %s", value * 100 / 128, descstr()); // TODO: item_howl -- verify
|
||||
case 6: return String.format("+%d %s %s", value, descstr(), descstr2());
|
||||
case 7: return String.format("%d%% %s %s", value, descstr(), descstr2());
|
||||
case 8: return String.format("+%d%% %s %s", value, descstr(), descstr2());
|
||||
case 9: return String.format("%d %s %s", value, descstr(), descstr2());
|
||||
case 11: return Riiablo.string.format("ModStre9u", 1, value / 100);
|
||||
case 12: return String.format("+%d %s", value, descstr());
|
||||
case 13: return String.format("+%d %s", value, Riiablo.string.lookup(CharacterClass.get(param).entry().StrAllSkills));
|
||||
case 14:
|
||||
entry = CharacterClass.get((param >>> 3) & 0x3).entry();
|
||||
return String.format("%s %s", Riiablo.string.format(entry.StrSkillTab[param & 0x7], value), Riiablo.string.lookup(entry.StrClassOnly));
|
||||
case 15: return toString();
|
||||
case 16: return toString();
|
||||
case 20: return String.format("%d%% %s", -value, descstr());
|
||||
case 22: return toString();
|
||||
case 23: return toString();
|
||||
case 24:
|
||||
int e3p1 = (param >>> 6) & 0x3FF;
|
||||
int e3p2 = param & 0x3F;
|
||||
int e3p3 = (value >>> 8) & 0xFF;
|
||||
int e3p4 = value & 0xFF;
|
||||
skill = Riiablo.files.skills.get(e3p1);
|
||||
desc = Riiablo.files.skilldesc.get(skill.skilldesc);
|
||||
return String.format("%s %d %s %s", Riiablo.string.lookup("ModStre10b"), e3p2, Riiablo.string.lookup(desc.str_name), Riiablo.string.format(stat.entry.descstrpos, e3p3, e3p4));
|
||||
case 27:
|
||||
skill = Riiablo.files.skills.get(param);
|
||||
desc = Riiablo.files.skilldesc.get(skill.skilldesc);
|
||||
entry = Riiablo.files.skills.getClass(skill.charclass).entry();
|
||||
return String.format("+%d %s %s %s", value, Riiablo.string.lookup("ItemStast1k"), Riiablo.string.lookup(desc.str_name), Riiablo.string.lookup(entry.StrClassOnly));
|
||||
case 28:
|
||||
skill = Riiablo.files.skills.get(param);
|
||||
desc = Riiablo.files.skilldesc.get(skill.skilldesc);
|
||||
return String.format("+%d %s %s", value, Riiablo.string.lookup("ItemStast1k"), Riiablo.string.lookup(desc.str_name));
|
||||
default: return toString();
|
||||
}
|
||||
}
|
||||
|
||||
private String descstr() {
|
||||
return Riiablo.string.lookup(value < 0 ? stat.entry.descstrneg : stat.entry.descstrpos);
|
||||
}
|
||||
|
||||
private String descstr2() {
|
||||
return Riiablo.string.lookup(stat.entry.descstr2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (stat.entry.Encode) {
|
||||
|
@ -55,6 +55,7 @@ public class ControlPanel extends Table implements Disposable {
|
||||
DC6 CharSkillicon[];
|
||||
|
||||
private static int getClassId(String charClass) {
|
||||
if (charClass.isEmpty()) return -1;
|
||||
switch (charClass.charAt(0)) {
|
||||
case 'a': return charClass.charAt(1) == 'm' ? CharacterClass.AMAZON.id : CharacterClass.ASSASSIN.id;
|
||||
case 'b': return CharacterClass.BARBARIAN.id;
|
||||
|
Reference in New Issue
Block a user