View Single Post
  #13  
Old 10-01-2015, 08:55 PM
AdrianD
Discordant
 
Join Date: Dec 2013
Posts: 297
Default

A bit of progress, not much though.

No entry being created like it does when zoning and using <SetPet(0);>

\zonedb.cpp - last 1/2 commented out, unsure what to do to make it create a new blank entry

When the part /* */ is uncommented it only removes `spell_id` in the DB - pet_struct maybe?
Code:
void ZoneDatabase::DeletePetInfo(Client *client)
{
	std::string query = StringFormat("DELETE FROM `character_pet_info` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
	auto results = database.QueryDatabase(query);
	if (!results.Success())
		return;

	query = StringFormat("DELETE FROM `character_pet_buffs` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
	results = database.QueryDatabase(query);
	if (!results.Success())
		return;

	query = StringFormat("DELETE FROM `character_pet_inventory` WHERE `char_id` = %u AND `pet` = 0", client->CharacterID());
	results = database.QueryDatabase(query);
	if (!results.Success())
		return;

//	PetInfo *petinfo = nullptr;
	/*
	for (int pet = 0; pet < 2; pet++) {
	PetInfo	*petinfo = client->GetPetInfo(pet);
		if (!petinfo)
			continue;

		query = StringFormat("INSERT INTO `character_pet_info` "
			"(`char_id`, `pet`, `petname`, `petpower`, `spell_id`, `hp`, `mana`, `size`) "
			"VALUES (%u, %u, '%s', %i, %u, %u, %u, %f) "
			"ON DUPLICATE KEY UPDATE `petname` = '%s', `petpower` = %i, `spell_id` = %u, "
			"`hp` = %u, `mana` = %u, `size` = %f",
			client->CharacterID(), pet, petinfo->Name, petinfo->petpower, petinfo->SpellID,
			petinfo->HP, petinfo->Mana, petinfo->size, // and now the ON DUPLICATE ENTRIES
			petinfo->Name, petinfo->petpower, petinfo->SpellID, petinfo->HP, petinfo->Mana, petinfo->size);
		results = database.QueryDatabase(query);
		if (!results.Success())
			return;
		query.clear();
		}	*/
}
\client_process.cpp
Code:
bool deletenorent = database.NoRentExpired(GetName());
	if (deletenorent) { //client was offline for more than 30 minutes, delete no rent items
		if (RuleB(Inventory, TransformSummonedBags))
			DisenchantSummonedBags(false);
		RemoveNoRent(false);

// added 9/30/15 no rent check (this may need fixing when introducing suspended minion - if this was an issue the queries below should fix it)
		if (!RuleB(Pets, PetLogPersistence))
		{				
			SetPet(0);
			
			database.DeletePetInfo(this);			
		}
	}
Thanks
Reply With Quote