mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
[8779] Not output error at empty item loot for mail template at mail creating.
This commit is contained in:
parent
a6d245058d
commit
d594a29af1
6 changed files with 20 additions and 18 deletions
|
|
@ -1526,29 +1526,29 @@ float Creature::GetAttackDistance(Unit const* pl) const
|
||||||
|
|
||||||
void Creature::setDeathState(DeathState s)
|
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;
|
m_deathTimer = m_corpseDelay*IN_MILISECONDS;
|
||||||
|
|
||||||
// always save boss respawn time at death to prevent crash cheating
|
// 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();
|
SaveRespawnTime();
|
||||||
|
|
||||||
if (canFly() && FallGround())
|
if (canFly() && FallGround())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!IsStopped())
|
if (!IsStopped())
|
||||||
StopMoving();
|
StopMoving();
|
||||||
}
|
}
|
||||||
Unit::setDeathState(s);
|
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)
|
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);
|
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||||
|
|
||||||
if(!isPet() && GetCreatureInfo()->SkinLootId)
|
if (!isPet() && GetCreatureInfo()->SkinLootId)
|
||||||
if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) )
|
if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId))
|
||||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||||
|
|
||||||
if (canFly() && FallGround())
|
if (canFly() && FallGround())
|
||||||
|
|
@ -1557,7 +1557,7 @@ void Creature::setDeathState(DeathState s)
|
||||||
SetNoSearchAssistance(false);
|
SetNoSearchAssistance(false);
|
||||||
Unit::setDeathState(CORPSE);
|
Unit::setDeathState(CORPSE);
|
||||||
}
|
}
|
||||||
if(s == JUST_ALIVED)
|
if (s == JUST_ALIVED)
|
||||||
{
|
{
|
||||||
SetHealth(GetMaxHealth());
|
SetHealth(GetMaxHealth());
|
||||||
SetLootRecipient(NULL);
|
SetLootRecipient(NULL);
|
||||||
|
|
|
||||||
|
|
@ -488,10 +488,8 @@ void GameObject::getFishLoot(Loot *fishloot, Player* loot_owner)
|
||||||
GetZoneAndAreaId(zone,subzone);
|
GetZoneAndAreaId(zone,subzone);
|
||||||
|
|
||||||
// if subzone loot exist use it
|
// if subzone loot exist use it
|
||||||
if(LootTemplates_Fishing.HaveLootFor(subzone))
|
if (!fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true))
|
||||||
fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner,true);
|
// else use zone loot (must exist in like case)
|
||||||
// else use zone loot
|
|
||||||
else
|
|
||||||
fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner,true);
|
fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -386,18 +386,19 @@ void Loot::AddItem(LootStoreItem const & item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calls processor of corresponding LootTemplate (which handles everything including references)
|
// 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
|
// Must be provided
|
||||||
if(!loot_owner)
|
if(!loot_owner)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
LootTemplate const* tab = store.GetLootFor(loot_id);
|
LootTemplate const* tab = store.GetLootFor(loot_id);
|
||||||
|
|
||||||
if (!tab)
|
if (!tab)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.",store.GetName(),loot_id);
|
if (!noEmptyError)
|
||||||
return;
|
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);
|
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
|
// ... for personal loot
|
||||||
else
|
else
|
||||||
FillNotNormalLootFor(loot_owner);
|
FillNotNormalLootFor(loot_owner);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loot::FillNotNormalLootFor(Player* pl)
|
void Loot::FillNotNormalLootFor(Player* pl)
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ struct Loot
|
||||||
void RemoveLooter(uint64 GUID) { PlayersLooting.erase(GUID); }
|
void RemoveLooter(uint64 GUID) { PlayersLooting.erase(GUID); }
|
||||||
|
|
||||||
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount);
|
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)
|
// Inserts the item into the loot (called by LootTemplate processors)
|
||||||
void AddItem(LootStoreItem const & item);
|
void AddItem(LootStoreItem const & item);
|
||||||
|
|
|
||||||
|
|
@ -837,7 +837,8 @@ void MailDraft::prepareItems(Player* receiver)
|
||||||
|
|
||||||
Loot mailLoot;
|
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);
|
uint32 max_slot = mailLoot.GetMaxSlotInLootFor(receiver);
|
||||||
for(uint32 i = 0; m_items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
for(uint32 i = 0; m_items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8778"
|
#define REVISION_NR "8779"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue