Hucaru / Valhalla

A Golang MapleStory (v28) server
MIT License
274 stars 71 forks source link

Added mob magic attack #15

Closed ErwinsExpertise closed 4 years ago

ErwinsExpertise commented 4 years ago

I am not sure what packet 0x6B is for. I noticed it when zakum is attacking, however, mobs magic attack works fine with 0x21. I think this might be related to effects? Not too sure. If you know please let me know so I can implement it as well.

ErwinsExpertise commented 4 years ago

2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 0E 00 00 00 03 00 00 00 2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 0F 00 00 00 03 00 00 00 2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 10 00 00 00 03 00 00 00 2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 11 00 00 00 03 00 00 00 2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 12 00 00 00 03 00 00 00 2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 13 00 00 00 03 00 00 00 2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 14 00 00 00 03 00 00 00 2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 15 00 00 00 03 00 00 00 2020/09/04 09:23:36 UNKNOWN CLIENT PACKET: [Packet] (9) : 6B 16 00 00 00 03 00 00 00

Doesn't look like a very complicated packet with minimal data. Working on finding what this is for.

Hucaru commented 4 years ago

It would appear the first byte after the opcode is a counter and maybe the 3 is the specific attack type/skill value. Checking in the WZ/NX under Zakum might shed some light.

EDIT: I wonder if it's an agro switching mechanic? Where the first int32 is monster id e.g. body and arms and the last int32 is a character id of either the character to be the new controller (and take agro) or the id of the current controller. Check if bosses lik Pianus emit a similar packet but with a static 4 bytes at the front.

ErwinsExpertise commented 4 years ago

This packet is appearing for Pianus as well. I tried other magic mobs(ex. cbalrog and balrog) and it does not appear. Oddly, the packet 2nd set of bytes appears to be changing rather than remaining constant for Pianus.

2020/09/04 11:36:00 [Packet] (9) : 6B 02 00 00 00 01 00 00 00 2020/09/04 11:36:01 [Packet] (9) : 6B 02 00 00 00 27 00 00 00 2020/09/04 11:36:02 [Packet] (9) : 6B 02 00 00 00 2C 00 00 00 2020/09/04 11:36:03 [Packet] (9) : 6B 02 00 00 00 2C 00 00 00

These packets only appear while the boss is using a magic attack. If it is a melee hit or not attacking at all then the packet does not appear. I've been looking through the IDB for v28 client to try and find the method for packet structure but can't locate it thus far.

Hucaru commented 4 years ago

I'm pretty confident the first int32 is the mob id in the pool (might need to still verify this). I guess the second int must be skill related? Does this get sent by the controller only?

As far as I can tell the IDB only has the server -> client packets named

ErwinsExpertise commented 4 years ago

Yep, you are correct the first int32 is the mob id in pool. The 2nd int32 must be skill related, but it is odd because zakum has multiple skills at once yet it remains constant.

2020/09/04 11:54:20 id: 2 attack: 32 mob: 2(8520000) 24000000/24000000 3000000/3000000 ( -29(x) 103(y)) 2020/09/04 11:54:21 id: 2 attack: 36 mob: 2(8520000) 24000000/24000000 3000000/3000000 ( -29(x) 103(y)) 2020/09/04 11:54:23 id: 2 attack: 49 mob: 2(8520000) 24000000/24000000 3000000/3000000 ( -29(x) 103(y))

id := reader.ReadInt32()
attack := reader.ReadInt32()
....
mob, _ := inst.LifePool().GetMobFromID(id)
log.Printf("id: %v\tattack: %v\tmob: %v\n", id, attack, mob)
Hucaru commented 4 years ago

Could test with a mob like Jr Boogie as that has 2 or 3 magic attacks (one of them seals skill usage if I am remembering correctly) and hopefully it does the same thing for each attack. There are 2 variants of the mob a jr boogie 1 and jr boogie 2, I think the 2 is the one that casts magic attacks.

EDIT: the second value seems to be position based, the further away you get from the mob the larger the value is.

ErwinsExpertise commented 4 years ago

Good catch. Unsure of what the use of this packet could be other than some sort of targeting system.

Hucaru commented 4 years ago

Are you happy for me to merge this in?

ErwinsExpertise commented 4 years ago

Yes this can be merged. Thank you for the help.