diff --git a/core/src/gdx/diablo/codec/StringTBL.java b/core/src/gdx/diablo/codec/StringTBL.java index 1fd5d56f..906063d2 100644 --- a/core/src/gdx/diablo/codec/StringTBL.java +++ b/core/src/gdx/diablo/codec/StringTBL.java @@ -19,9 +19,9 @@ import java.util.Arrays; public class StringTBL { private static final String TAG = "StringTBL"; - private static final boolean DEBUG = false; - private static final boolean DEBUG_ENTRIES = DEBUG && false; - private static final boolean DEBUG_LOOKUP = DEBUG && false; + private static final boolean DEBUG = !true; + private static final boolean DEBUG_ENTRIES = DEBUG && !true; + private static final boolean DEBUG_LOOKUP = DEBUG && !true; public static final short CLASSIC_OFFSET = 0; public static final short PATCH_OFFSET = 10000; @@ -96,8 +96,9 @@ public class StringTBL { KEY.offset = entry.keyOffset - header.startIndex; KEY.length = entry.strOffset - entry.keyOffset - 1; if (key.contentEquals(KEY)) { - if (DEBUG_LOOKUP) Gdx.app.debug(TAG, "Took " + hashTries); - return new String(text, entry.strOffset - header.startIndex, entry.strLen - 1); + String value = new String(text, entry.strOffset - header.startIndex, entry.strLen - 1); + if (DEBUG_LOOKUP) Gdx.app.debug(TAG, key + " took " + hashTries + " : \"" + value + "\""); + return value; } } else { return null; diff --git a/core/src/gdx/diablo/codec/StringTBLs.java b/core/src/gdx/diablo/codec/StringTBLs.java index 48bccbd0..c7aa0e6f 100644 --- a/core/src/gdx/diablo/codec/StringTBLs.java +++ b/core/src/gdx/diablo/codec/StringTBLs.java @@ -67,4 +67,12 @@ public class StringTBLs { public String format(int index, Object... args) { return String.format(lookup(index), args); } + + public String lookup(String key) { + String str; + if ((str = patchstring.lookup(key)) != null) return str; + if ((str = expansionstring.lookup(key)) != null) return str; + if ((str = string.lookup(key)) != null) return str; + return "ERROR: " + key; + } } diff --git a/core/src/gdx/diablo/codec/excel/ItemEntry.java b/core/src/gdx/diablo/codec/excel/ItemEntry.java index ca59456e..bdf1ac44 100644 --- a/core/src/gdx/diablo/codec/excel/ItemEntry.java +++ b/core/src/gdx/diablo/codec/excel/ItemEntry.java @@ -11,6 +11,7 @@ public class ItemEntry extends Excel.Entry { public String code; @Column public String name; + @Column public String namestr; @Column public int version; @Column public String alternateGfx; @Column public String type; diff --git a/core/src/gdx/diablo/entity/Monster.java b/core/src/gdx/diablo/entity/Monster.java index f37d9c8b..05c66f99 100644 --- a/core/src/gdx/diablo/entity/Monster.java +++ b/core/src/gdx/diablo/entity/Monster.java @@ -38,7 +38,7 @@ public class Monster extends Entity { this.monstats = monstats; this.monstats2 = Diablo.files.monstats2.get(monstats.MonStatsEx); className = monstats.Id; - setName(monstats.NameStr); + setName(monstats.NameStr.equalsIgnoreCase("dummy") ? monstats.Id : Diablo.string.lookup(monstats.NameStr)); setWeaponClass(monstats2.BaseW); setMode(monstats.spawnmode.isEmpty() ? "NU" : monstats.spawnmode); setWalkSpeed(monstats.Velocity); diff --git a/core/src/gdx/diablo/entity/StaticEntity.java b/core/src/gdx/diablo/entity/StaticEntity.java index 34d07334..4d127532 100644 --- a/core/src/gdx/diablo/entity/StaticEntity.java +++ b/core/src/gdx/diablo/entity/StaticEntity.java @@ -27,32 +27,14 @@ public class StaticEntity extends Entity { className = base.Description; // FIXME: Find how this association is actually made if (base.SubClass == 64) { - String levelName; - int id = getLevelName(zone); - if (id != 0) { - levelName = Diablo.string.lookup(id); - } else { - levelName = zone.level.LevelName; - } - setName(String.format("%s\n%s", levelName, Diablo.string.lookup(3257))); + String levelName = Diablo.string.lookup(zone.level.LevelName); + setName(String.format("%s\n%s", levelName, Diablo.string.lookup(base.Name))); } else { - switch (base.Id) { - case 267: setName(Diablo.string.lookup(3292)); break; - default: setName(base.Name); - } + setName(base.Name.equalsIgnoreCase("dummy") ? base.Description : Diablo.string.lookup(base.Name)); } init(); } - private int getLevelName(Map.Zone zone) { - switch (zone.level.Id) { - case 1: return 5055; - case 2: return 5054; - case 8: return 5048; - default: return 0; - } - } - public static StaticEntity create(Map map, Map.Zone zone, DS1 ds1, DS1.Object obj) { assert obj.type == DS1.Object.STATIC_TYPE; @@ -173,7 +155,11 @@ public class StaticEntity extends Entity { case 0: break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: - case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: + break; + // Rogue Bonfire + case 10: + break; + case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: break; default: Gdx.app.error(TAG, "Invalid ClientFn for " + getName() + ": " + base.ClientFn); diff --git a/core/src/gdx/diablo/item/Item.java b/core/src/gdx/diablo/item/Item.java index d1d0eecf..3d38a20c 100644 --- a/core/src/gdx/diablo/item/Item.java +++ b/core/src/gdx/diablo/item/Item.java @@ -362,12 +362,12 @@ public class Item extends Actor implements Disposable { case HIGH: if ((flags & RUNEWORD) == RUNEWORD) { int runeword = RunewordData.id(runewordData); - name.append(Diablo.files.Runes.get(runeword).Rune_Name); + name.append(Diablo.string.lookup(Diablo.files.Runes.get(runeword).Name)); break; } else if (socketsFilled > 0) { name.append(Diablo.string.lookup(1728)) // Gemmed .append(' ') - .append(base.name); + .append(Diablo.string.lookup(base.namestr)); break; } @@ -375,47 +375,47 @@ public class Item extends Actor implements Disposable { case LOW: name.append(Diablo.string.lookup(LowQuality.valueOf(qualityId).stringId)) .append(' ') - .append(base.name); + .append(Diablo.string.lookup(base.namestr)); break; case HIGH: name.append(Diablo.string.lookup(1727)) // Superior .append(' ') - .append(base.name); + .append(Diablo.string.lookup(base.namestr)); break; default: - name.append(base.name); + name.append(Diablo.string.lookup(base.namestr)); } break; case MAGIC: prefix = qualityId & MAGIC_AFFIX_MASK; suffix = qualityId >>> MAGIC_AFFIX_SIZE; - if ((affix = Diablo.files.MagicPrefix.get(prefix)) != null) name.append(affix.name).append(' '); - name.append(base.name); - if ((affix = Diablo.files.MagicSuffix.get(suffix)) != null) name.append(' ').append(affix.name); + if ((affix = Diablo.files.MagicPrefix.get(prefix)) != null) name.append(Diablo.string.lookup(affix.name)).append(' '); + name.append(Diablo.string.lookup(base.namestr)); + if ((affix = Diablo.files.MagicSuffix.get(suffix)) != null) name.append(' ').append(Diablo.string.lookup(affix.name)); break; case RARE: case CRAFTED: prefix = qualityId & RARE_AFFIX_MASK; suffix = qualityId >>> RARE_AFFIX_SIZE; - name.append(Diablo.files.RarePrefix.get(prefix).name) + name.append(Diablo.string.lookup(Diablo.files.RarePrefix.get(prefix).name)) .append(' ') - .append(Diablo.files.RareSuffix.get(suffix).name); + .append(Diablo.string.lookup(Diablo.files.RareSuffix.get(suffix).name)); break; case SET: - name.append(Diablo.files.SetItems.get(qualityId).index); + name.append(Diablo.string.lookup(Diablo.files.SetItems.get(qualityId).index)); break; case UNIQUE: - name.append(Diablo.files.UniqueItems.get(qualityId).index); + name.append(Diablo.string.lookup(Diablo.files.UniqueItems.get(qualityId).index)); break; default: - name.append(base.name); + name.append(Diablo.string.lookup(base.namestr)); } this.name = name.toString(); @@ -590,7 +590,7 @@ public class Item extends Actor implements Disposable { BitmapFont font = Diablo.fonts.font16; name = new Label(Item.this.getName(), font); - type = new Label(base.name, font); + type = new Label(Diablo.string.lookup(base.namestr), font); switch (quality) { case LOW: case NORMAL: