All pastes #983877 Raw Edit

Zeug

public text v1 · immutable
·published 2008-04-13 18:25 UTC
rendered paste body
bool ItemUse_item_cooking_pot(Player *player, Item* _Item, SpellCastTargets const& targets)
{
	Unit * unit_target = targets.getUnitTarget();
	if (player->GetQuestStatus(11379) == QUEST_STATUS_INCOMPLETE)
	{
        if( unit_target && 
            unit_target->GetTypeId()==TYPEID_UNIT &&
            unit_target->isDead() && unit_target->GetEntry()==19973 )// cast only on corpse 19973
		{
			ItemPosCountVec dest;
			uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, 43753, 1);
			if( msg == EQUIP_ERR_OK )
			{
				player->DestroyItemCount(31672, 2, true);
				player->DestroyItemCount(31673, 1, true);
				Item * item = player->StoreNewItem( dest, 43753, 1);
			}else player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL);
			((Creature*)unit_target)->RemoveCorpse(); 	// remove corpse for cancelling second use
			return false;                                   // all ok
		}
	}
    WorldPacket data(SMSG_CAST_RESULT, (4+2));              // prepare packet error message
    data << uint32(33852);                                  // itemId
    data << uint8(SPELL_FAILED_BAD_TARGETS);                // reason
    player->GetSession()->SendPacket(&data);                // send message: Bad target
    player->SendEquipError(EQUIP_ERR_NONE,_Item,NULL);      // break spell
    return true;
}