mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-03-06 07:30:41 +07:00
Implemented some use-cases for readRaw
Implemented some use-cases for readRaw and readU63 Replaced some Java primitive size consts with actual bit sizes according to d2 spec
This commit is contained in:
parent
a0a46dc481
commit
0050720249
@ -51,7 +51,7 @@ public class ItemSerializer {
|
||||
readSignature(bitStream);
|
||||
Item item = new Item();
|
||||
item.reset();
|
||||
item.flags = (int) bitStream.readUnsigned(Integer.SIZE);
|
||||
item.flags = (int) bitStream.readRaw(32);
|
||||
Log.tracef(log, "flags: 0x%08X [%s]", item.flags, item.getFlagsString());
|
||||
item.version = bitStream.readU8(Byte.SIZE);
|
||||
log.trace("version: {}", item.version);
|
||||
@ -93,7 +93,7 @@ public class ItemSerializer {
|
||||
|
||||
private static void readStandard(BitStream bitStream, Item item) {
|
||||
item.data = bitStream.getBufferView(); // TODO: remove when serialization implemented
|
||||
item.id = (int) bitStream.readUnsigned(Integer.SIZE);
|
||||
item.id = (int) bitStream.readRaw(32);
|
||||
Log.tracef(log, "id: 0x%08X", item.id);
|
||||
item.ilvl = bitStream.readU7(7);
|
||||
item.quality = Quality.valueOf(bitStream.readU7(4));
|
||||
@ -187,7 +187,7 @@ public class ItemSerializer {
|
||||
|
||||
private static boolean readRunewordData(BitStream bitStream, Item item) {
|
||||
boolean hasRunewordData = (item.flags & Item.ITEMFLAG_RUNEWORD) == Item.ITEMFLAG_RUNEWORD;
|
||||
item.runewordData = hasRunewordData ? (short) bitStream.readUnsigned(Short.SIZE) : 0;
|
||||
item.runewordData = hasRunewordData ? (short) bitStream.readRaw(16) : 0;
|
||||
return hasRunewordData;
|
||||
}
|
||||
|
||||
|
@ -184,9 +184,9 @@ public class D2S {
|
||||
data.waypointData[i][4] = bitStream.readU31(9);
|
||||
|
||||
bitStream = new BitStream(npcs.data[NPCData.GREETING_INTRO][i]);
|
||||
data.npcIntroData[i] = bitStream.readUnsigned(64);
|
||||
data.npcIntroData[i] = bitStream.readRaw(64);
|
||||
bitStream = new BitStream(npcs.data[NPCData.GREETING_RETURN][i]);
|
||||
data.npcReturnData[i] = bitStream.readUnsigned(64);
|
||||
data.npcReturnData[i] = bitStream.readRaw(64);
|
||||
}
|
||||
|
||||
PropertyList base = data.statData.base();
|
||||
@ -669,7 +669,7 @@ public class D2S {
|
||||
case 0xA: stamina = bitStream.readU31(numBits(id)); break;
|
||||
case 0xB: maxstamina = bitStream.readU31(numBits(id)); break;
|
||||
case 0xC: level = bitStream.readU31(numBits(id)); break;
|
||||
case 0xD: experience = bitStream.readUnsigned(numBits(id)); break;
|
||||
case 0xD: experience = bitStream.readU63(numBits(id)); break;
|
||||
case 0xE: gold = bitStream.readU31(numBits(id)); break;
|
||||
case 0xF: goldbank = bitStream.readU31(numBits(id)); break;
|
||||
default: continue;
|
||||
|
Loading…
Reference in New Issue
Block a user