[9947] More skinning fixes.

* Restore work with money loot.
* Old code sometime generate empty loot windows for normal loot and sometime skip its.
  Code changed to be more consistent. Added new option Corpse.EmptyLootShow that control
  show empty normal loot window in some cases enabled by default:
   - if creature expected to be lootable but loot generated empty by some reasons.
   - if creature can be skinnable
  If option disabled thne code attempt avoid empty normal loot windows for empty cases.
* Possible fixed case instant despawn non-skinable creature after normal loot complete.
This commit is contained in:
VladimirMangos 2010-05-21 09:47:58 +04:00
parent c2fc89c86c
commit 2591a2333a
6 changed files with 28 additions and 20 deletions

View file

@ -816,26 +816,26 @@ void Creature::PrepareBodyLootState()
loot.clear(); loot.clear();
// if have normal loot then prepare it access // if have normal loot then prepare it access
if (!isAlive() && GetCreatureInfo()->lootid && !lootForBody) if (!isAlive() && !lootForBody)
{ {
SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); // have normal loot
return; if (GetCreatureInfo()->maxgold > 0 || GetCreatureInfo()->lootid ||
// ... or can have skinning after
GetCreatureInfo()->SkinLootId && sWorld.getConfig(CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW))
{
SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
return;
}
} }
// if not have normal loot allow skinning if need // if not have normal loot allow skinning if need
if (!isAlive() && !lootForSkin) if (!isAlive() && !lootForSkin && GetCreatureInfo()->SkinLootId)
{ {
lootForBody = true; // pass this loot mode lootForBody = true; // pass this loot mode
if (GetCreatureInfo()->SkinLootId) RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
{ SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId)) return;
{
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
return;
}
}
} }
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
@ -2031,14 +2031,14 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*
void Creature::AllLootRemovedFromCorpse() void Creature::AllLootRemovedFromCorpse()
{ {
if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE)) if (lootForBody && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE))
{ {
uint32 nDeathTimer; uint32 nDeathTimer;
CreatureInfo const *cinfo = GetCreatureInfo(); CreatureInfo const *cinfo = GetCreatureInfo();
// corpse was not skinnable -> apply corpse looted timer // corpse was not skinnable -> apply corpse looted timer
if (!cinfo || !cinfo->SkinLootId) if (!cinfo->SkinLootId)
nDeathTimer = (uint32)((m_corpseDelay * IN_MILLISECONDS) * sWorld.getConfig(CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED)); nDeathTimer = (uint32)((m_corpseDelay * IN_MILLISECONDS) * sWorld.getConfig(CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED));
// corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update // corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
else else

View file

@ -2623,10 +2623,10 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex)
for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); ++iter) for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); ++iter)
{ {
// Remove all harmful spells on you except positive/passive/physical auras // Remove all harmful spells on you except positive/passive/physical auras
if( !iter->second->IsPositive() if (!iter->second->IsPositive() &&
&& !iter->second->IsPassive() !iter->second->IsPassive() &&
&& !iter->second->IsDeathPersistent() !iter->second->IsDeathPersistent() &&
&& (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0 ) (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0)
{ {
m_caster->RemoveAurasDueToSpell(iter->second->GetSpellProto()->Id); m_caster->RemoveAurasDueToSpell(iter->second->GetSpellProto()->Id);
iter = Auras.begin(); iter = Auras.begin();

View file

@ -691,6 +691,7 @@ void World::LoadConfigSettings(bool reload)
setConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY, "ChatStrictLinkChecking.Severity", 0); setConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY, "ChatStrictLinkChecking.Severity", 0);
setConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK, "ChatStrictLinkChecking.Kick", 0); setConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK, "ChatStrictLinkChecking.Kick", 0);
setConfig(CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW, "Corpse.EmptyLootShow", true);
setConfigPos(CONFIG_UINT32_CORPSE_DECAY_NORMAL, "Corpse.Decay.NORMAL", 60); setConfigPos(CONFIG_UINT32_CORPSE_DECAY_NORMAL, "Corpse.Decay.NORMAL", 60);
setConfigPos(CONFIG_UINT32_CORPSE_DECAY_RARE, "Corpse.Decay.RARE", 300); setConfigPos(CONFIG_UINT32_CORPSE_DECAY_RARE, "Corpse.Decay.RARE", 300);
setConfigPos(CONFIG_UINT32_CORPSE_DECAY_ELITE, "Corpse.Decay.ELITE", 300); setConfigPos(CONFIG_UINT32_CORPSE_DECAY_ELITE, "Corpse.Decay.ELITE", 300);

View file

@ -297,6 +297,7 @@ enum eConfigBoolValues
CONFIG_BOOL_CHAT_STRICT_LINK_CHECKING_SEVERITY, CONFIG_BOOL_CHAT_STRICT_LINK_CHECKING_SEVERITY,
CONFIG_BOOL_CHAT_STRICT_LINK_CHECKING_KICK, CONFIG_BOOL_CHAT_STRICT_LINK_CHECKING_KICK,
CONFIG_BOOL_ADDON_CHANNEL, CONFIG_BOOL_ADDON_CHANNEL,
CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW,
CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVP, CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVP,
CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVE,
CONFIG_BOOL_DEATH_BONES_WORLD, CONFIG_BOOL_DEATH_BONES_WORLD,

View file

@ -829,6 +829,11 @@ TalentsInspecting = 1
# Difference for boss dynamic level with target # Difference for boss dynamic level with target
# Default: 3 # Default: 3
# #
# Corpse.EmptyLootShow
# If target can have loot (or can be skining after loot) but no loot generated still show loot window
# Default: 1 (show)
# 0 (not show)
#
# Corpse.Decay.NORMAL # Corpse.Decay.NORMAL
# Corpse.Decay.RARE # Corpse.Decay.RARE
# Corpse.Decay.ELITE # Corpse.Decay.ELITE
@ -886,6 +891,7 @@ CreatureFamilyAssistanceRadius = 10
CreatureFamilyAssistanceDelay = 1500 CreatureFamilyAssistanceDelay = 1500
CreatureFamilyFleeDelay = 7000 CreatureFamilyFleeDelay = 7000
WorldBossLevelDiff = 3 WorldBossLevelDiff = 3
Corpse.EmptyLootShow = 1
Corpse.Decay.NORMAL = 60 Corpse.Decay.NORMAL = 60
Corpse.Decay.RARE = 300 Corpse.Decay.RARE = 300
Corpse.Decay.ELITE = 300 Corpse.Decay.ELITE = 300

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9946" #define REVISION_NR "9947"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__