From 842aa8ffe30f491eb6535a89dca08ea4a14f2bf1 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 21 May 2010 09:47:58 +0400 Subject: [PATCH] [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. --- src/game/Creature.cpp | 30 +++++++++++++++--------------- src/game/SpellEffects.cpp | 8 ++++---- src/game/World.cpp | 1 + src/game/World.h | 1 + src/mangosd/mangosd.conf.dist.in | 6 ++++++ src/shared/revision_nr.h | 2 +- 6 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index a8dba28db69..3c58d47a6ea 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -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); @@ -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 diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index da0b9d63116..e41c4dd4884 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -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(); diff --git a/src/game/World.cpp b/src/game/World.cpp index 9d4d78735a0..abf273dce2c 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -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); diff --git a/src/game/World.h b/src/game/World.h index b3360e0ce24..b289b9154d1 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -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, diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index f9088e304e4..673ed2a120d 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -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 @@ -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 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 26a03131567..69e900aa62d 100644 --- a/src/shared/revision_nr.h +++ b/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__