[8779] Not output error at empty item loot for mail template at mail creating.

This commit is contained in:
VladimirMangos 2009-11-06 02:34:49 +03:00
parent a6d245058d
commit d594a29af1
6 changed files with 20 additions and 18 deletions

View file

@ -1526,29 +1526,29 @@ float Creature::GetAttackDistance(Unit const* pl) const
void Creature::setDeathState(DeathState s)
{
if((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
if ((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
{
m_deathTimer = m_corpseDelay*IN_MILISECONDS;
// always save boss respawn time at death to prevent crash cheating
if(sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY) || isWorldBoss())
if (sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY) || isWorldBoss())
SaveRespawnTime();
if (canFly() && FallGround())
return;
if(!IsStopped())
if (!IsStopped())
StopMoving();
}
Unit::setDeathState(s);
if(s == JUST_DIED)
if (s == JUST_DIED)
{
SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
if(!isPet() && GetCreatureInfo()->SkinLootId)
if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) )
if (!isPet() && GetCreatureInfo()->SkinLootId)
if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId))
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
if (canFly() && FallGround())
@ -1557,7 +1557,7 @@ void Creature::setDeathState(DeathState s)
SetNoSearchAssistance(false);
Unit::setDeathState(CORPSE);
}
if(s == JUST_ALIVED)
if (s == JUST_ALIVED)
{
SetHealth(GetMaxHealth());
SetLootRecipient(NULL);

View file

@ -488,10 +488,8 @@ void GameObject::getFishLoot(Loot *fishloot, Player* loot_owner)
GetZoneAndAreaId(zone,subzone);
// if subzone loot exist use it
if(LootTemplates_Fishing.HaveLootFor(subzone))
fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner,true);
// else use zone loot
else
if (!fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true))
// else use zone loot (must exist in like case)
fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner,true);
}

View file

@ -386,18 +386,19 @@ void Loot::AddItem(LootStoreItem const & item)
}
// Calls processor of corresponding LootTemplate (which handles everything including references)
void Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal)
bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError)
{
// Must be provided
if(!loot_owner)
return;
return false;
LootTemplate const* tab = store.GetLootFor(loot_id);
if (!tab)
{
sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.",store.GetName(),loot_id);
return;
if (!noEmptyError)
sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.",store.GetName(),loot_id);
return false;
}
items.reserve(MAX_NR_LOOT_ITEMS);
@ -416,6 +417,8 @@ void Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
// ... for personal loot
else
FillNotNormalLootFor(loot_owner);
return true;
}
void Loot::FillNotNormalLootFor(Player* pl)

View file

@ -284,7 +284,7 @@ struct Loot
void RemoveLooter(uint64 GUID) { PlayersLooting.erase(GUID); }
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount);
void FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal);
bool FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError = false);
// Inserts the item into the loot (called by LootTemplate processors)
void AddItem(LootStoreItem const & item);

View file

@ -837,7 +837,8 @@ void MailDraft::prepareItems(Player* receiver)
Loot mailLoot;
mailLoot.FillLoot(m_mailTemplateId, LootTemplates_Mail, receiver,true);
// can be empty
mailLoot.FillLoot(m_mailTemplateId, LootTemplates_Mail, receiver, true, true);
uint32 max_slot = mailLoot.GetMaxSlotInLootFor(receiver);
for(uint32 i = 0; m_items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8778"
#define REVISION_NR "8779"
#endif // __REVISION_NR_H__