Skip to content

Commit

Permalink
[9947] More skinning fixes.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
VladimirMangos committed May 21, 2010
1 parent 570eed5 commit 842aa8f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
30 changes: 15 additions & 15 deletions src/game/Creature.cpp
Expand Up @@ -816,26 +816,26 @@ void Creature::PrepareBodyLootState()
loot.clear();

// if have normal loot then prepare it access
if (!isAlive() && GetCreatureInfo()->lootid && !lootForBody)
if (!isAlive() && !lootForBody)
{
SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
return;
// have normal loot
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 (!isAlive() && !lootForSkin)
if (!isAlive() && !lootForSkin && GetCreatureInfo()->SkinLootId)
{
lootForBody = true; // pass this loot mode

if (GetCreatureInfo()->SkinLootId)
{
if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId))
{
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
return;
}
}
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
return;
}

RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
Expand Down Expand Up @@ -2031,14 +2031,14 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*

void Creature::AllLootRemovedFromCorpse()
{
if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE))
if (lootForBody && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE))
{
uint32 nDeathTimer;

CreatureInfo const *cinfo = GetCreatureInfo();

// 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));
// corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
else
Expand Down
8 changes: 4 additions & 4 deletions src/game/SpellEffects.cpp
Expand Up @@ -2623,10 +2623,10 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex)
for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); ++iter)
{
// Remove all harmful spells on you except positive/passive/physical auras
if( !iter->second->IsPositive()
&& !iter->second->IsPassive()
&& !iter->second->IsDeathPersistent()
&& (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0 )
if (!iter->second->IsPositive() &&
!iter->second->IsPassive() &&
!iter->second->IsDeathPersistent() &&
(GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0)
{
m_caster->RemoveAurasDueToSpell(iter->second->GetSpellProto()->Id);
iter = Auras.begin();
Expand Down
1 change: 1 addition & 0 deletions src/game/World.cpp
Expand Up @@ -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_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_RARE, "Corpse.Decay.RARE", 300);
setConfigPos(CONFIG_UINT32_CORPSE_DECAY_ELITE, "Corpse.Decay.ELITE", 300);
Expand Down
1 change: 1 addition & 0 deletions src/game/World.h
Expand Up @@ -297,6 +297,7 @@ enum eConfigBoolValues
CONFIG_BOOL_CHAT_STRICT_LINK_CHECKING_SEVERITY,
CONFIG_BOOL_CHAT_STRICT_LINK_CHECKING_KICK,
CONFIG_BOOL_ADDON_CHANNEL,
CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW,
CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVP,
CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVE,
CONFIG_BOOL_DEATH_BONES_WORLD,
Expand Down
6 changes: 6 additions & 0 deletions src/mangosd/mangosd.conf.dist.in
Expand Up @@ -829,6 +829,11 @@ TalentsInspecting = 1
# Difference for boss dynamic level with target
# 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.RARE
# Corpse.Decay.ELITE
Expand Down Expand Up @@ -886,6 +891,7 @@ CreatureFamilyAssistanceRadius = 10
CreatureFamilyAssistanceDelay = 1500
CreatureFamilyFleeDelay = 7000
WorldBossLevelDiff = 3
Corpse.EmptyLootShow = 1
Corpse.Decay.NORMAL = 60
Corpse.Decay.RARE = 300
Corpse.Decay.ELITE = 300
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9946"
#define REVISION_NR "9947"
#endif // __REVISION_NR_H__

0 comments on commit 842aa8f

Please sign in to comment.