Thread: NPC Loot bugfix
View Single Post
  #1  
Old 01-31-2002, 06:12 PM
alkrun
Sarnak
 
Join Date: Jan 2002
Posts: 66
Default NPC Loot bugfix

This is to correct corpses from poofing even when you leave items on the corpse. It's just a check to see if the loot count is zero.


client_process.cpp - line(1226) - OP_EndLootRequest handler

Code:
APPLAYER* outapp = new APPLAYER;
outapp->opcode = OP_LootComplete;
outapp->size = 0;
QueuePacket(outapp);
delete outapp;

//NEW CODE
if(entity->IsNPC()){
	NPC *pNpc = (NPC*)entity;
	if(pNpc->CountLoot() == 0){
		outapp = new APPLAYER;
		outapp->opcode = OP_DeleteSpawn;
		outapp->size = sizeof(DeleteSpawn_Struct);
		outapp->pBuffer = new uchar[outapp->size];
		DeleteSpawn_Struct* delspawn = (DeleteSpawn_Struct*)outapp->pBuffer;
		delspawn->spawn_id = entity->GetID();
		delspawn->ds_unknown1 = 0;
		entity_list.QueueClients(this, outapp, false);
		delete outapp;
		entity_list.RemoveEntity(entity->GetID());
	}
}
//END NEW CODE

outapp = new APPLAYER;
outapp->opcode = OP_SpawnAppearance;
outapp->size = sizeof(SpawnAppearance2_Struct);
outapp->pBuffer = new uchar[outapp->size];
SpawnAppearance2_Struct* sa_out = (SpawnAppearance2_Struct*)outapp->pBuffer;
sa_out->spawn_id = id;
sa_out->type = 0x0e;
sa_out->parameter = 110; // stand...
entity_list.QueueClients(this, app);
delete outapp;

break;
}
Reply With Quote