UF and ROF2 spawn packet packet for chests now working properly.

This commit is contained in:
Natedog2012 2016-01-28 13:23:58 -08:00
parent 430be0f2b7
commit 3ce3f591a8
5 changed files with 90 additions and 10 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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);
}
}
}