Originally Posted by
Jason
So far you seem to be encoding and decoding the opcode fine, but what you send for each mask is still not apparent. Paste the following functions referenced in this block.
Code:
if(npc.animation != -1) appendAnimUpdate(npc, updateBlock); if(npc.hit2 != -1) appendHitUpdate2(npc, updateBlock); if(npc.graphic != -1) appendGraphic(npc, updateBlock); if(npc.getFace() != -1) appendFaceEntity(npc, updateBlock); if (npc.forcedText.equals("") == false) updateBlock.writeString(npc.forcedText); if(npc.hit1 != -1) appendHitUpdate(npc, updateBlock); if(npc.transformId != -1) appendTransformUpdate(npc, updateBlock); if(npc.facingX != -1 && npc.facingY != -1) appendFaceToUpdate(npc, updateBlock);
Code:
private static void appendAnimUpdate(Npc npc, Stream stream) {
stream.writeWordBigEndian(npc.animation);
stream.writeByte(0);
}
private static void appendHitUpdate2(Npc npc, Stream stream) {
stream.writeByteC(npc.hit2);
stream.writeByteS(npc.hitType2);
stream.writeByteS(getCurrentHP(npc.health, npc.maxHealth, 100));
stream.writeByteC(100);
}
private static void appendGraphic(Npc npc, Stream str) {
str.writeWord(npc.graphic);
str.writeDWord(npc.graphicHeight << 16);
}
private static void appendFaceEntity(Npc npc, Stream str) {
str.writeWord(npc.getFace());
}
private static void appendHitUpdate(Npc npc, Stream stream) {
stream.writeByteC(npc.hit1);
stream.writeByteS(npc.hitType1);
stream.writeByteS(getCurrentHP(npc.health, npc.maxHealth, 100));
stream.writeByteC(100);
}
private static void appendTransformUpdate(Npc npc, Stream str) {
str.writeWordBigEndianA(npc.transformId);
}
private static void appendFaceToUpdate(Npc npc, Stream stream) {
stream.writeWordBigEndian(npc.facingX);
stream.writeWordBigEndian(npc.facingY);
}
Edit: If been looking and comparing for a while now but i could not find the diffrence my self
and it just happend again and this is what k and npccount printed
Code:
k = 47
java.lang.RuntimeException: eek
npcCount = 9