Permalink
Browse files

FIXED: Creatures which have neither item nor money loot, should not b…

…e lootable.
  • Loading branch information...
1 parent 4215329 commit 6ba74cf5f9644086e74206f13c80343591288cde @dfighter1985 dfighter1985 committed Mar 16, 2012
Showing with 30 additions and 1 deletion.
  1. +8 −0 src/arcemu-world/LootMgr.cpp
  2. +15 −0 src/arcemu-world/LootMgr.h
  3. +7 −1 src/arcemu-world/Unit.cpp
@@ -557,6 +557,14 @@ void LootMgr::AddLoot(Loot* loot, uint32 itemid, uint32 mincount, uint32 maxcoun
}
}
+bool LootMgr::HasLootForCreature( uint32 loot_id ){
+ LootStore::iterator itr = CreatureLoot.find( loot_id );
+ if( itr != CreatureLoot.end() )
+ return true;
+ else
+ return false;
+}
+
void LootMgr::FillCreatureLoot(Loot* loot, uint32 loot_id, uint32 type)
{
loot->items.clear();
View
@@ -148,6 +148,21 @@ class SERVER_DECL LootMgr : public Singleton < LootMgr >
void AddLoot(Loot* loot, uint32 itemid, uint32 mincount, uint32 maxcount);
+ ////////////////////////////////////////////////////////////////////////////
+ //bool HasLootForCreature( uint32 loot_id )
+ // Tells if there's loot cached for the specified creature.
+ //
+ //Parameter(s)
+ // uint32 loot_id - The identifier of the creature
+ //
+ //Return Value
+ // Returns true if there's loot for this creature.
+ // Returns false otherwise.
+ //
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ bool HasLootForCreature( uint32 loot_id );
+
void FillCreatureLoot(Loot* loot, uint32 loot_id, uint32 type);
void FillGOLoot(Loot* loot, uint32 loot_id, uint32 type);
void FillItemLoot(Loot* loot, uint32 loot_id);
@@ -7805,8 +7805,14 @@ uint64 Unit::GetTaggerGUID()
bool Unit::isLootable()
{
- if(IsTagged() && !IsPet() && !isCritter() && !(IsPlayer() && !IsInBg()) && ( GetCreatedByGUID() == 0 ) && !IsVehicle() )
+ if(IsTagged() && !IsPet() && !isCritter() && !(IsPlayer() && !IsInBg()) && ( GetCreatedByGUID() == 0 ) && !IsVehicle() ){
+ if( IsCreature() &&
+ !lootmgr.HasLootForCreature( GetEntry() ) &&
+ ( CreatureProtoStorage.LookupEntry( GetEntry() )->money == 0 ) ) // Since it is inworld we can safely assume there is a proto cached with this Id!
+ return false;
+
return true;
+ }
else
return false;
}

0 comments on commit 6ba74cf

Please sign in to comment.