[7239] Support multiply items loot and not normal loot items in Player::AutoStoreLoot.

Use this function in more cases and simplify and fix some related code.
This commit is contained in:
VladimirMangos 2009-02-07 10:07:27 +03:00
parent 7d63f4ce02
commit 5e2553ff7e
7 changed files with 36 additions and 53 deletions

View file

@ -1518,26 +1518,10 @@ void Aura::TriggerSpell()
Creature* creature = (Creature*)target;
// missing lootid has been reported on startup - just return
if (!creature->GetCreatureInfo()->SkinLootId)
{
return;
}
Loot *loot = &creature->loot;
loot->clear();
loot->FillLoot(creature->GetCreatureInfo()->SkinLootId, LootTemplates_Skinning, player, true);
for(uint8 i=0;i<loot->items.size();i++)
{
LootItem *item = loot->LootItemInSlot(i,player);
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item->itemid, item->count );
if ( msg == EQUIP_ERR_OK )
{
Item * newitem = player->StoreNewItem( dest, item->itemid, true, item->randomPropertyId);
player->SendNewItem(newitem, uint32(item->count), false, false, true);
}
else
player->SendEquipError( msg, NULL, NULL );
}
player->AutoStoreLoot(creature->GetCreatureInfo()->SkinLootId,LootTemplates_Skinning,true);
creature->setDeathState(JUST_DIED);
creature->RemoveCorpse();
creature->SetHealth(0); // just for nice GM-mode view