All pastes #1423815 Raw Edit

RaiseDead

public cpp v1 · immutable
#1423815 ·published 2009-05-15 16:00 UTC
rendered paste body
Index: Object.cpp===================================================================--- Object.cpp	(revision 1395)+++ Object.cpp	(working copy)@@ -2908,6 +2908,18 @@ 	return float2int32(cost); // Truncate zeh decimals! } +bool Object::IsGiveXPorHonor(PlayerPointer plr, UnitPointer Target)+{+	if( Target->IsCreature() )+		if( Target->IsPet() || CalculateXpToGive(Target, plr ) <= 0 ) 			+			return false;++	if( Target->IsPlayer() )+		if( HonorHandler::CalculateHonorPointsForKill( plr , Target ) <= 0 )+			return false;+	return true;+}+ void Object::CastSpell( ObjectPointer Target, SpellEntry* Sp, bool triggered ) { 	if( Sp == NULL )Index: Object.h===================================================================--- Object.h	(revision 1395)+++ Object.h	(working copy)@@ -173,6 +173,7 @@ 	HEARTHSTONE_INLINE bool IsCreature() { return m_objectTypeId == TYPEID_UNIT; } 	HEARTHSTONE_INLINE bool IsVehicle() { return m_isVehicle; } 	bool IsPet();+	bool IsGiveXPorHonor(PlayerPointer plr, UnitPointer Target);  	//! This includes any nested objects we have, inventory for example. 	virtual uint32 __fastcall BuildCreateUpdateBlockForPlayer( ByteBuffer *data, PlayerPointer target );Index: SpellAuras.cpp===================================================================--- SpellAuras.cpp	(revision 1395)+++ SpellAuras.cpp	(working copy)@@ -6652,42 +6652,33 @@ 	} 	else 	{-		if(m_target->GetTypeId() == TYPEID_UNIT && TO_CREATURE(m_target)->GetCreatureName())+		if(m_target && m_target->isDead()) 		{-			if(TO_CREATURE(m_target)->GetCreatureName()->Type != CRITTER)-			{-				if(m_target->isDead())-				{-					PlayerPointer pCaster = m_target->GetMapMgr()->GetPlayer((uint32)m_casterGuid);-					if(!pCaster)-						return;-				-					uint32 itemid = GetSpellProto()->EffectItemType[mod->i];-					if(itemid == 6265 && int32(pCaster->getLevel() - m_target->getLevel()) > 9)-						return;+			PlayerPointer pCaster = m_target->GetMapMgr()->GetPlayer((uint32)m_casterGuid);+			if(!pCaster)+				return; -					ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(itemid);-					if(pCaster->GetItemInterface()->CalculateFreeSlots(proto) > 0)-					{-						ItemPointer item = objmgr.CreateItem(itemid,pCaster);-						if(!item) return;+			uint32 itemid = GetSpellProto()->EffectItemType[mod->i];+			if(itemid == 6265 && pCaster->IsGiveXPorHonor(pCaster, m_target ) == false )+				return; --						item->SetUInt64Value(ITEM_FIELD_CREATOR,pCaster->GetGUID());-						if(!pCaster->GetItemInterface()->AddItemToFreeSlot(item))-						{-							pCaster->GetItemInterface()->BuildInventoryChangeError(NULLITEM, NULLITEM, INV_ERR_INVENTORY_FULL);-							item->Destructor();-							item = NULLITEM;-							return;-						}-						/*WorldPacket data(45);-						pCaster->GetSession()->BuildItemPushResult(&data, pCaster->GetGUID(), 1, 1, itemid ,0,0xFF,1,0xFFFFFFFF);-						pCaster->SendMessageToSet(&data, true);					*/-						SlotResult * lr = pCaster->GetItemInterface()->LastSearchResult();-						pCaster->GetSession()->SendItemPushResult(item,true,false,true,true,lr->ContainerSlot,lr->Slot,1);-					}+			ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(itemid);+			if(pCaster->GetItemInterface()->CalculateFreeSlots(proto) > 0)+			{+				ItemPointer item = objmgr.CreateItem(itemid,pCaster);+				if(!item) return;+				+				item->SetUInt64Value(ITEM_FIELD_CREATOR,pCaster->GetGUID());+				if(!pCaster->GetItemInterface()->AddItemToFreeSlot(item))+				{+					pCaster->GetItemInterface()->BuildInventoryChangeError(NULLITEM, NULLITEM, INV_ERR_INVENTORY_FULL);+					item->Destructor();+					item = NULLITEM;+					return; 				}+				+				SlotResult * lr = pCaster->GetItemInterface()->LastSearchResult();+				pCaster->GetSession()->SendItemPushResult(item,true,false,true,true,lr->ContainerSlot,lr->Slot,1); 			} 		} 	}@@ -9621,4 +9612,4 @@ 				mod->m_amount =  4; 		}break; 	}-}\ No newline at end of file+}Index: Unit.cpp===================================================================--- Unit.cpp	(revision 1395)+++ Unit.cpp	(working copy)@@ -2008,7 +2008,7 @@ 						case 50475: 							{ 								//heal him :)-								if( dmg )+								if( dmg && IsGiveXPorHonor(plr_shared_from_this(), victim)) 								{ 									int32 toheal = (int32)(dmg * 0.04); 									Heal( unit_shared_from_this(), 50475, toheal );