From ce98118cc8eada38423c24899622b14ec97d0288 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 8 Dec 2024 22:56:34 -0800 Subject: [PATCH] Basic spellcasting works a bit. --- common/patches/laurion.cpp | 23 +++++++++++++++++++++++ common/patches/laurion_ops.h | 1 + common/patches/laurion_structs.h | 29 +++++++++++++++++++++++++++++ utils/patches/patch_Laurion.conf | 12 ++++++------ 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/common/patches/laurion.cpp b/common/patches/laurion.cpp index f51c4f051..fbd13c71c 100644 --- a/common/patches/laurion.cpp +++ b/common/patches/laurion.cpp @@ -3048,6 +3048,29 @@ namespace Laurion FINISH_ENCODE(); } + ENCODE(OP_Action) { + ENCODE_LENGTH_EXACT(Action_Struct); + SETUP_DIRECT_ENCODE(Action_Struct, structs::MissileHitInfo); + + //This is mostly figured out; there's two unknowns, only unknown1 is read by the client + OUT(target); + OUT(source); + eq->spell_id = emu->spell; + eq->effect_type = emu->effect_flag; + eq->effective_casting_level = 0; //if you set this to != 0 it will use this level instead of calculating it + eq->unknown1 = 0; + eq->unknown2 = 0; + eq->damage = 0; //client doesn't read this but live sends it here, can just set 0 + eq->modifier = 1.0f + (emu->instrument_mod - 10) / 10.0f; + OUT(force); + OUT(hit_heading); + OUT(hit_pitch); + eq->skill = emu->type; + OUT(level); + + FINISH_ENCODE(); + } + // DECODE methods DECODE(OP_EnterWorld) diff --git a/common/patches/laurion_ops.h b/common/patches/laurion_ops.h index 979b8f673..39319461b 100644 --- a/common/patches/laurion_ops.h +++ b/common/patches/laurion_ops.h @@ -39,6 +39,7 @@ E(OP_BeginCast) E(OP_BuffCreate) E(OP_Buff) E(OP_ManaChange) +E(OP_Action) //list of packets we need to decode on the way in: D(OP_EnterWorld) D(OP_ZoneEntry) diff --git a/common/patches/laurion_structs.h b/common/patches/laurion_structs.h index 0f1d1c00d..de05afdb9 100644 --- a/common/patches/laurion_structs.h +++ b/common/patches/laurion_structs.h @@ -704,6 +704,35 @@ namespace Laurion { int32 slot; }; + //This is what we call OP_Action + //To the client though this is basically a missile hit though + //OP_Action is basically "instant missile hit" to the client + //@0x1401f0970 MissileHitInfo::Deserialize(CUnSerializeBuffer *buffer); + struct MissileHitInfo + { + uint16 target; + uint16 source; + uint32 spell_id; + //4 leaves a buff + uint32 effect_type; + uint32 effective_casting_level; + //Client does read this but only does something if it's negative + int64 unknown1; + //I don't see the client read this one outside basic serialization + int64 unknown2; + //I don't see the client read this one either but based on captures from live it seems to match spell damage + int64 damage; + float modifier; + float force; + float hit_heading; + float hit_pitch; + //same convention as damage + //231 for spell, otherwise it's skill in use + uint8 skill; + uint8 level; //the client doesn't actually deserialize anything past level + //live however has a lot more info here depending on packet type + }; + #pragma pack() }; //end namespace structs diff --git a/utils/patches/patch_Laurion.conf b/utils/patches/patch_Laurion.conf index 944338be1..425e714c9 100644 --- a/utils/patches/patch_Laurion.conf +++ b/utils/patches/patch_Laurion.conf @@ -103,7 +103,7 @@ OP_SendAAStats=0x0000 OP_AAExpUpdate=0x0000 #0x642f OP_ExpUpdate=0x611d OP_HPUpdate=0x775c -OP_ManaChange=0x0606 +OP_ManaChange=0x700f OP_TGB=0x0000 #removed; tgb is baked in and always on OP_SpecialMesg=0x7d93 OP_GuildMemberList=0x0000 @@ -173,17 +173,17 @@ OP_QueryUCSServerStatus=0x0000 OP_InspectRequest=0x0000 OP_InspectAnswer=0x0000 OP_InspectMessageUpdate=0x0000 -OP_BeginCast=0x0000 +OP_BeginCast=0x31f9 OP_ColoredText=0x0000 OP_ConsentResponse=0x0000 OP_MemorizeSpell=0x0000 OP_LinkedReuse=0x0000 OP_SwapSpell=0x0000 -OP_CastSpell=0x0000 +OP_CastSpell=0x325b OP_Consider=0x53e3 OP_FormattedMessage=0x7f7f OP_SimpleMessage=0x1943 -OP_Buff=0x0000 #0x6ce5 +OP_Buff=0x6ce5 OP_Illusion=0x0000 OP_MoneyOnCorpse=0x0000 OP_RandomReply=0x0000 @@ -209,7 +209,7 @@ OP_ClearSurname=0x0000 OP_FaceChange=0x0000 OP_SetFace=0x0000 OP_SenseHeading=0x0000 -OP_Action=0x0000 +OP_Action=0x4c13 OP_ConsiderCorpse=0x6092 OP_HideCorpse=0x0000 OP_CorpseDrag=0x0000 @@ -247,7 +247,7 @@ OP_XTargetRequest=0x0000 OP_XTargetAutoAddHaters=0x0000 OP_XTargetOpen=0x0000 OP_XTargetOpenResponse=0x0000 -OP_BuffCreate=0x0000 #0x27a1 +OP_BuffCreate=0x27a1 OP_BuffRemoveRequest=0x0000 OP_DeleteSpawn=0x7712 OP_AutoAttack=0x3f03