It's not in the attack packet. The attack packet (server recv, that is) contains no information about critical hits. You have to do it entirely serversided, which is why it's so difficult.I know what crits are but the idea of your post is not giving me any meaning. You should probably look at the damage parsing and the attack oacket
It's not in the attack packet. The attack packet (server recv, that is) contains no information about critical hits. You have to do it entirely serversided, which is why it's so difficult.
It's not in the attack packet. The attack packet (server recv, that is) contains no information about critical hits. You have to do it entirely serversided, which is why it's so difficult.
It's not in the attack packet. The attack packet (server recv, that is) contains no information about critical hits. You have to do it entirely serversided, which is why it's so difficult.
if (ret.skill == 3221007) {
damage += 0x80000000; // Critical damage = 0x80000000 + damage
}
So I found this in damageParse in AbstractDealDamageHandler.
Code:if (ret.skill == 3221007) { damage += 0x80000000; // Critical damage = 0x80000000 + damage }
I noticed that the Marksman skill Snipe did show its crit in the third person. So to test out if my theory was true I did ret.skill != 3221007 so that all my other skills would do third person crits, which it did. But now my normal attacks are not working (including Mortal Blow for Archers). I'm not sure why that happens.
Do you mean certain skills are not showing up as Crits or do you mean crit. damage isn't appearing when you do damage?
I'm thinking its because his damagePurse() isn't including other skills that also does crits, to show up as crits for 3rd person, since Snipe worked. Like Critical Throw which only add damage on to my watk, and doesn't even do the success rate to show the critical damage.
I'm thinking its because his damagePurse() isn't including other skills that also does crits, to show up as crits, since Snipe worked. Like Critical Throw which only add damage on to my watk, and doesn't even do the success rate to show the critical damage.
ByteBuffer b = ByteBuffer.allocate(4);
b.putInt(damage);
byte[] result = b.array();
if (result[1] > 0) {
damage += 0x80000000; //Critical
}
if (ret.skill == Marksman.SNIPE) {
damage += 0x80000000; //Critical
}
I thought he had DamageParse() since he posted "damageParse in AbstractDealDamageHandler". Maybe it was v83 and wasn't v62? I'm not going to try to calculate crit as seeing that is quite a hard thing to do, but just to display the crit colour text in 3rd person.
Crit. Colour Text Temp fix:
Place within parseDamage():
Code:ByteBuffer b = ByteBuffer.allocate(4); b.putInt(damage); byte[] result = b.array(); if (result[1] > 0) { damage += 0x80000000; //Critical }
Replace:
Code:if (ret.skill == Marksman.SNIPE) { damage += 0x80000000; //Critical }
This is a cheating method, I can't promised that it will work 100%, but it seems to be working on my end atm.
This was tested on v83. ~
Maybe one day, I'll try to calculate crits, but atm I'm still inexperience, and still busy from time to time.
Credit toYou must be registered to see linkson stackoverflow for ByteBuffer example.
Just making sure, but can you post your whole parseDamage() if you have one that is o-o?Thanks for trying to help, unfortunately its a no-go on my end. Doesn't display the crits at all. :\
Just making sure, but can you post your whole parseDamage() if you have one that is o-o?
public AttackInfo parseDamage(LittleEndianAccessor lea, boolean ranged) {
// TODO we need information if an attack was a crit or not but it does not seem to be in this packet - find out
// if it is o.o
// noncrit strafe
// 24 00
// 01
// 14
// FE FE 30 00
// 00
// 97
// 04 06 99 2F EE 00 04 00 00 00 41
// 6B 00 00 00
// 06 81 00 01 00 00 5F 00 00 00 5F 00 D2 02
// A3 19 00 00 43 0C 00 00 AD 0B 00 00 DB 12 00 00 64 00 5F 00
//
// fullcrit strafe:
// 24 00
// 01
// 14
// FE FE 30 00
// 00
// 97
// 04 06 F5 C3 EE 00 04 00 00 00 41
// 6B 00 00 00
// 06 81 00 01 00 00 5F 00 00 00 5F 00 D2 02
// 6E 0F 00 00 EA 12 00 00 58 15 00 00 56 11 00 00 64 00 5F 00
AttackInfo ret = new AttackInfo();
lea.readByte();
ret.numAttackedAndDamage = lea.readByte();
ret.numAttacked = (ret.numAttackedAndDamage >>> 4) & 0xF; // guess why there are no skills damaging more than 15 monsters...
ret.numDamage = ret.numAttackedAndDamage & 0xF; // how often each single monster was attacked o.o
ret.allDamage = new ArrayList<Pair<Integer, List<Integer>>>();
ret.skill = lea.readInt();
switch (ret.skill) {
case 2121001:
case 2221001:
case 2321001:
case 5101004:
case 5201002:
ret.charge = lea.readInt();
break;
default:
ret.charge = 0;
break;
}
if (ret.skill == 1221011) {
ret.isHH = true;
}
lea.readByte(); // always 0 (?)
ret.stance = lea.readByte();
if (ret.skill == 4211006) {
return parseMesoExplosion(lea, ret);
}
if (ranged) {
lea.readByte();
ret.speed = lea.readByte();
lea.readByte();
ret.direction = lea.readByte(); // contains direction on some 4th job skills
lea.skip(7);
// hurricane and pierce have extra 4 bytes :/
switch (ret.skill) {
case 3121004:
case 3221001:
case 5221004:
lea.skip(4);
break;
default:
break;
}
} else {
lea.readByte();
ret.speed = lea.readByte();
lea.skip(4);
}
for (int i = 0; i < ret.numAttacked; i++) {
int oid = lea.readInt();
// System.out.println("Unk2: " + HexTool.toString(lea.read(14)));
lea.skip(14); // seems to contain some position info o.o
List<Integer> allDamageNumbers = new ArrayList<Integer>();
for (int j = 0; j < ret.numDamage; j++) {
int damage = lea.readInt();
// System.out.println("Damage: " + damage);
if (ret.skill == 3221007) {
damage += 0x80000000; // Critical damage = 0x80000000 + damage
}
allDamageNumbers.add(Integer.valueOf(damage));
}
if (ret.skill != 5221004) {
lea.skip(4);
}
ret.allDamage.add(new Pair<Integer, List<Integer>>(Integer.valueOf(oid), allDamageNumbers));
}
// System.out.println("Unk3: " + HexTool.toString(lea.read(4)));
return ret;
}