From 3ce3f591a83edb4d5f51746af8697c7a868f5182 Mon Sep 17 00:00:00 2001 From: Natedog2012 Date: Thu, 28 Jan 2016 13:23:58 -0800 Subject: [PATCH] UF and ROF2 spawn packet packet for chests now working properly. --- common/patches/rof2.cpp | 81 ++++++++++++++++++++++++++++++++--- common/patches/uf.cpp | 11 +++-- utils/patches/patch_RoF2.conf | 3 ++ utils/patches/patch_UF.conf | 3 ++ zone/client.cpp | 2 +- 5 files changed, 90 insertions(+), 10 deletions(-) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index e0e8f307f..1b2da5cda 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4076,6 +4076,17 @@ namespace RoF2 if (strlen(emu->suffix)) PacketSize += strlen(emu->suffix) + 1; + if (emu->DestructibleObject || emu->class_ == 62) + { + if (emu->DestructibleObject) + PacketSize = PacketSize - 4; // No bodytype + + PacketSize += 53; // Fixed portion + PacketSize += strlen(emu->DestructibleModel) + 1; + PacketSize += strlen(emu->DestructibleName2) + 1; + PacketSize += strlen(emu->DestructibleString) + 1; + } + bool ShowName = 1; if (emu->bodytype >= 66) { @@ -4110,7 +4121,14 @@ namespace RoF2 VARSTRUCT_ENCODE_STRING(Buffer, emu->name); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->spawnId); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level); - VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7); // Eye Height? + if (emu->DestructibleObject) + { + VARSTRUCT_ENCODE_TYPE(float, Buffer, 10); // was int and 0x41200000 + } + else + { + VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7); // Eye Height? + } VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); structs::Spawn_Struct_Bitfields *Bitfields = (structs::Spawn_Struct_Bitfields*)Buffer; @@ -4130,6 +4148,12 @@ namespace RoF2 Bitfields->targetable_with_hotkey = emu->targetable_with_hotkey ? 1 : 0; Bitfields->showname = ShowName; + if (emu->DestructibleObject) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x1d600000); + Buffer = Buffer - 4; + } + // Not currently found // Bitfields->statue = 0; // Bitfields->buyer = 0; @@ -4138,21 +4162,66 @@ namespace RoF2 uint8 OtherData = 0; + if (emu->class_ == 62) //LDoN Chest + OtherData = OtherData | 0x04; + if (strlen(emu->title)) OtherData = OtherData | 16; if (strlen(emu->suffix)) OtherData = OtherData | 32; + if (emu->DestructibleObject) + OtherData = OtherData | 0xe1; // Live has 0xe1 for OtherData + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, OtherData); - VARSTRUCT_ENCODE_TYPE(float, Buffer, -1); // unknown3 + if (emu->DestructibleObject) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00000000); + } + else + { + VARSTRUCT_ENCODE_TYPE(float, Buffer, -1); // unknown3 + } VARSTRUCT_ENCODE_TYPE(float, Buffer, 0); // unknown4 - // Setting this next field to zero will cause a crash. Looking at ShowEQ, if it is zero, the bodytype field is not - // present. Will sort that out later. - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 1); // This is a properties count field - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->bodytype); + if (emu->DestructibleObject || emu->class_ == 62) + { + VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleModel); + VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleName2); + VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleString); + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleAppearance); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleUnk1); + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleID1); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleID2); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleID3); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleID4); + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleUnk2); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleUnk3); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleUnk4); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleUnk5); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleUnk6); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleUnk7); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->DestructibleUnk8); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->DestructibleUnk9); + } + + + if (!emu->DestructibleObject) + { + // Setting this next field to zero will cause a crash. Looking at ShowEQ, if it is zero, the bodytype field is not + // present. Will sort that out later. + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 1); // This is a properties count field + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->bodytype); + } + else + { + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); + } VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->curHp); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->haircolor); diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index c42de5145..adcd8f241 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -2818,9 +2818,11 @@ namespace UF if (strlen(emu->suffix)) PacketSize += strlen(emu->suffix) + 1; - if (emu->DestructibleObject) + if (emu->DestructibleObject || emu->class_ == 62) { - PacketSize = PacketSize - 4; // No bodytype + if (emu->DestructibleObject) + PacketSize = PacketSize - 4; // No bodytype + PacketSize += 53; // Fixed portion PacketSize += strlen(emu->DestructibleModel) + 1; PacketSize += strlen(emu->DestructibleName2) + 1; @@ -2903,6 +2905,9 @@ namespace UF uint8 OtherData = 0; + if (emu->class_ == 62) //Ldon chest + OtherData = OtherData | 0x01; + if (strlen(emu->title)) OtherData = OtherData | 0x04; @@ -2924,7 +2929,7 @@ namespace UF } VARSTRUCT_ENCODE_TYPE(float, Buffer, 0); // unknown4 - if (emu->DestructibleObject) + if (emu->DestructibleObject || emu->class_ == 62) { VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleModel); VARSTRUCT_ENCODE_STRING(Buffer, emu->DestructibleName2); diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 6afb7209e..8ae8a1a69 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -540,6 +540,9 @@ OP_FeignDeath=0x52fa OP_Mend=0x0ecf OP_Bind_Wound=0x0386 OP_LDoNOpen=0x3d5c +#OP_LDoNDisarmTraps= #Same as OP_DisarmTraps in RoF +OP_LDoNPickLock=0x9be3 +OP_LDoNInspect=0x0438 # Task packets OP_TaskDescription=0x3714 diff --git a/utils/patches/patch_UF.conf b/utils/patches/patch_UF.conf index e3af9aa7d..1e57a202d 100644 --- a/utils/patches/patch_UF.conf +++ b/utils/patches/patch_UF.conf @@ -535,6 +535,9 @@ OP_InstillDoubt=0x221a # C OP_FeignDeath=0x002b # C OP_Mend=0x10a6 # C OP_LDoNOpen=0x032b # C +OP_LDoNDisarmTraps=0x1a84 +OP_LDoNPickLock=0x0370 +OP_LDoNInspect=0x0aaa # Task packets OP_TaskActivityComplete=0x5832 # C diff --git a/zone/client.cpp b/zone/client.cpp index c8c1494e5..e24c24627 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4638,7 +4638,7 @@ void Client::HandleLDoNOpen(NPC *target) AddEXP(target->GetLevel()*target->GetLevel()*2625/10, GetLevelCon(target->GetLevel())); } } - target->Death(this, 1, SPELL_UNKNOWN, SkillHandtoHand); + target->Death(this, 0, SPELL_UNKNOWN, SkillHandtoHand); } } }