Resurrection - Fix for RoF + fixed a couple of memory leaks.

This commit is contained in:
Derision 2013-03-15 19:37:29 +00:00
parent a14fecaf78
commit 810fdf3cca
6 changed files with 63 additions and 19 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 03/15/2013 ==
Derision: RoF: Added ENCODE for Resurrect_struct (Accepting a rez should now work).
Derision: Fixed a couple of memory leaks in Rez code.
== 03/14/2013 ==
JJ: (NatedogEZ) Fix for hate list random never selecting last member of hate list.

View File

@ -3987,6 +3987,24 @@ ENCODE(OP_BeginCast)
FINISH_ENCODE();
}
ENCODE(OP_RezzRequest)
{
SETUP_DIRECT_ENCODE(Resurrect_Struct, structs::Resurrect_Struct);
OUT(zone_id);
OUT(instance_id);
OUT(y);
OUT(x);
OUT(z);
OUT_str(your_name);
OUT_str(rezzer_name);
OUT(spellid);
OUT_str(corpse_name);
OUT(action);
FINISH_ENCODE();
}
DECODE(OP_BuffRemoveRequest)
{
// This is to cater for the fact that short buff box buffs start at 30 as opposed to 25 in prior clients.
@ -4777,6 +4795,25 @@ DECODE(OP_GuildStatus)
FINISH_DIRECT_DECODE();
}
DECODE(OP_RezzAnswer)
{
DECODE_LENGTH_EXACT(structs::Resurrect_Struct);
SETUP_DIRECT_DECODE(Resurrect_Struct, structs::Resurrect_Struct);
IN(zone_id);
IN(instance_id);
IN(y);
IN(x);
IN(z);
memcpy(emu->your_name, eq->your_name, sizeof(emu->your_name));
memcpy(emu->rezzer_name, eq->rezzer_name, sizeof(emu->rezzer_name));
IN(spellid);
memcpy(emu->corpse_name, eq->corpse_name, sizeof(emu->corpse_name));
IN(action);
FINISH_DIRECT_DECODE();
}
uint32 NextItemInstSerialNumber = 1;
uint32 MaxInstances = 2000000000;

View File

@ -100,6 +100,7 @@ E(OP_MercenaryDataResponse)
E(OP_GuildMemberUpdate)
E(OP_GMLastName)
E(OP_BeginCast)
E(OP_RezzRequest)
//list of packets we need to decode on the way in:
D(OP_SetServerFilter)
D(OP_CharacterCreate)
@ -156,5 +157,6 @@ D(OP_GuildRemove)
D(OP_GuildStatus)
D(OP_Trader)
D(OP_GMLastName)
D(OP_RezzAnswer)
#undef E
#undef D

View File

@ -2792,20 +2792,23 @@ struct Underworld_Struct {
float z;
};
struct Resurrect_Struct {
uint32 unknown00;
uint16 zone_id;
uint16 instance_id;
float y;
float x;
float z;
char your_name[64];
uint32 unknown88;
char rezzer_name[64];
uint32 spellid;
char corpse_name[64];
uint32 action;
/* 228 */
struct Resurrect_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint16 zone_id;
/*006*/ uint16 instance_id;
/*008*/ float y;
/*012*/ float x;
/*016*/ float z;
/*020*/ uint32 unknown020;
/*024*/ char your_name[64];
/*088*/ uint32 unknown088;
/*092*/ char rezzer_name[64];
/*156*/ uint32 spellid;
/*160*/ char corpse_name[64];
/*224*/ uint32 action;
/*228*/ uint32 unknown228;
/*232*/
};
struct SetRunMode_Struct {

View File

@ -1578,9 +1578,9 @@ uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char*
}
if(rezzed){
if (!RunQuery(query, MakeAnyLenString(&query, "update player_corpses set rezzed = 1 WHERE id=%d",dbid), errbuf)) {
safe_delete_array(query);
cerr << "Error in UpdatePlayerCorpse/Rezzed query: " << errbuf << endl;
}
safe_delete_array(query);
}
return dbid;
}

View File

@ -4768,10 +4768,8 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app)
void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app)
{
if (app->size != sizeof(Resurrect_Struct)) {
LogFile->write(EQEMuLog::Error, "Wrong size: OP_RezzAnswer, size=%i, expected %i", app->size, sizeof(Resurrect_Struct));
return;
}
VERIFY_PACKET_LENGTH(OP_RezzAnswer, app, Resurrect_Struct);
const Resurrect_Struct* ra = (const Resurrect_Struct*) app->pBuffer;
_log(SPELLS__REZ, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s",
@ -4788,6 +4786,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app)
// the rezzed corpse is in to mark the corpse as rezzed.
outapp->SetOpcode(OP_RezzComplete);
worldserver.RezzPlayer(outapp, 0, 0, OP_RezzComplete);
safe_delete(outapp);
}
return;
}