Пример #1
0
void Weapon::EndContact(PhysicsActor *actThisPtr, PhysicsActor *actOtherPtr)
{
	// We're not interested in the wielder or other actors
	if ((actThisPtr != m_HitRegionPtr)
		|| ((m_WielderPtr != nullptr) && (m_WielderPtr->GetActor() == actOtherPtr)))
	{
		return;
	}

	// Check whether it is the player,
	// Else check whether it is an enemy.
	Level* level = Singleton<Level>::GetInstance();

	if ((level->GetPlayer() != nullptr) && (actOtherPtr == level->GetPlayer()->GetActor()))
	{
		RemoveTarget(level->GetPlayer());
	}
	else
	{
		const std::vector<Enemy*>& enemies = level->GetEnemies();
		for (std::vector<Enemy*>::const_iterator it = enemies.cbegin(); it != enemies.cend(); ++it)
		{
			if ((*it)->GetActor() == actOtherPtr)
			{
				RemoveTarget(*it);
			}
		}

	}
}
Пример #2
0
void Tower::Update(float deltaTime)
{
	ElapsedTime += deltaTime;
	
	if (!Targets.empty())
	{
		CurrTarget = Targets[0];
		LookAtTarget(CurrTarget->Transform.Position.ToVec2());

		if (Distance(CurrTarget->Transform.Position.ToVec2()) <= Range)
		{
			if (ElapsedTime >= FireTimer)
			{
				ElapsedTime = 0;
				EventData e(SHOOT_BULLET, static_cast<void *>(&Owner));
				EventManager::PostEvent(e);
				Log("Firing bullet");
			}
		}
		else
		{
			RemoveTarget(CurrTarget);
		}

	}
}
void CMultiStateMover::FindPositionEntities() {
	// Go through all the targets and find the PositionEntities
	for( int i = 0; i < targets.Num(); i++ ) {
		idEntity *target = targets[i].GetEntity();
		if( !target->IsType( CMultiStateMoverPosition::Type ) ) {
			continue;
		}
		CMultiStateMoverPosition *moverPos = static_cast<CMultiStateMoverPosition *>( target );
		DM_LOG( LC_ENTITY, LT_INFO )LOGSTRING( "Parsing multistate position entity %s.\r", moverPos->name.c_str() );
		idStr positionName;
		if( !moverPos->spawnArgs.GetString( "position", "", positionName ) || positionName.IsEmpty() ) {
			gameLocal.Warning( "'position' spawnarg on %s is missing.", moverPos->name.c_str() );
			continue;
		}
		if( GetPositionInfoIndex( positionName ) != -1 ) {
			gameLocal.Warning( "Multiple positions with name %s defined for %s.", positionName.c_str(), name.c_str() );
			continue;
		}
		// greebo: Seems like the position entity is valid, let's build an info structure
		MoverPositionInfo info;
		info.positionEnt = moverPos;
		info.name = positionName;
		positionInfo.Append( info );
		// Associate the mover position with this entity
		moverPos->SetMover( this );
	}
	// Now remove all the MultiStatePositionInfo entities from the elevator targets
	// to avoid triggering of positionInfo entities when the elevator is reaching different floors.
	for( int i = 0; i < positionInfo.Num(); i++ ) {
		RemoveTarget( positionInfo[i].positionEnt.GetEntity() );
	}
}
Пример #4
0
bool
CCBServer::ReconnectTarget( CCBTarget *target, CCBID reconnect_cookie )
{
	CCBReconnectInfo *reconnect_info = GetReconnectInfo(target->getCCBID());
	if( !reconnect_info ) {
		dprintf(D_ALWAYS,
				"CCB: reconnect request from target daemon %s with ccbid %lu"
				", but this ccbid has no reconnect info!\n",
				target->getSock()->peer_description(),
				target->getCCBID());
		return false;
	}

	char const *previous_ip = reconnect_info->getPeerIP();
	char const *new_ip = target->getSock()->peer_ip_str();
	if( strcmp(previous_ip,new_ip) )
	{
		dprintf(D_ALWAYS,
				"CCB: reconnect request from target daemon %s with ccbid %lu "
				"has wrong IP!  (expected IP=%s)\n",
				target->getSock()->peer_description(),
				target->getCCBID(),
				previous_ip);
		return false;
	}

	if( reconnect_cookie != reconnect_info->getReconnectCookie() )
	{
		dprintf(D_ALWAYS,
				"CCB: reconnect request from target daemon %s with ccbid %lu "
				"has wrong cookie!  (cookie=%lu)\n",
				target->getSock()->peer_description(),
				target->getCCBID(),
				reconnect_cookie);
		return false;
	}

	reconnect_info->alive();

	CCBTarget *existing = NULL;
	if( m_targets.lookup(target->getCCBID(),existing) == 0 ) {
		// perhaps we haven't noticed yet that this existing target socket
		// has become disconnected; get rid of it
		dprintf(D_ALWAYS,
				"CCB: disconnecting existing connection from target daemon "
				"%s with ccbid %lu because this daemon is reconnecting.\n",
				existing->getSock()->peer_description(),
				target->getCCBID());
		RemoveTarget( existing );
	}

	ASSERT( m_targets.insert(target->getCCBID(),target) == 0 );

	dprintf(D_FULLDEBUG,"CCB: reconnected target daemon %s with ccbid %lu\n",
			target->getSock()->peer_description(),
			target->getCCBID());

	return true;
}
void    plCubicRenderTargetModifier::AddTarget( plSceneObject *so )
{
    if( fTarget != nil )
        RemoveTarget( fTarget );

    fTarget = so;
    plgDispatch::Dispatch()->RegisterForExactType( plEvalMsg::Index(), GetKey() );
}
bool    plCubicRenderTargetModifier::MsgReceive( plMessage* msg )
{
    plEvalMsg* eval = plEvalMsg::ConvertNoRef(msg);
    if (eval)
    {
        const double secs = eval->DSeconds();
        const float del = eval->DelSeconds();
        IEval(secs, del, 0);
        return true;
    }

    plRefMsg* refMsg = plRefMsg::ConvertNoRef(msg);
    if (refMsg)
    {
        plSceneObject* scene = plSceneObject::ConvertNoRef(refMsg->GetRef());
        if (scene)
        {
            if (refMsg->GetContext() & (plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace))
                AddTarget(scene);
            else
                RemoveTarget(scene);
        }

        plCubicRenderTarget* cubic = plCubicRenderTarget::ConvertNoRef(refMsg->GetRef());
        if (cubic)
        {
            if (refMsg->GetContext() & (plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace))
            {
                fCubic = cubic;
                for (int i = 0; i < 6; i++)
                    ICreateRenderRequest(i);
            }
            else
            {
                fCubic = nullptr;
                for (int i = 0; i < 6; i++)
                {
                    delete fRequests[i];
                    fRequests[i] = nullptr;
                }
            }
        }

        return true;
    }

    return plModifier::MsgReceive(msg);
}
Пример #7
0
CCBServer::~CCBServer()
{
	CloseReconnectFile();
	if( m_registered_handlers ) {
		daemonCore->Cancel_Command(CCB_REGISTER);
		daemonCore->Cancel_Command(CCB_REQUEST);
		m_registered_handlers = false;
	}
	if( m_polling_timer != -1 ) {
		daemonCore->Cancel_Timer( m_polling_timer );
		m_polling_timer = -1;
	}
	CCBTarget *target=NULL;
	m_targets.startIterations();
	while( m_targets.iterate(target) ) {
		RemoveTarget(target);
	}
}
void CMultiStateMoverPosition::Event_PostSpawn()
{
	// Find all AAS obstacle entities among the targets
	for (int i = 0; i < targets.Num(); i++)
	{
		idEntity* target = targets[i].GetEntity();

		if (target != NULL && target->IsType(idFuncAASObstacle::Type))
		{
			// Allocate a new list element and call the operator=
			aasObstacleEntities.Alloc() = static_cast<idFuncAASObstacle*>(target);
		}
	}

	// Remove all AAS obstacle entities from our targets, they should not be blindly triggered
	for (int i = 0; i < aasObstacleEntities.Num(); i++)
	{
		RemoveTarget(aasObstacleEntities[i].GetEntity());
	}
}
Пример #9
0
void ObservableLooper::_handleRemoveObserver(
    BMessage*								message) {

//	PRINT(("ObservableLooper::_handleRemoveObserver():\n"
//		"  %ld targets\n", CountTargets()));
    BMessage reply;

    BMessenger observer;
    status_t err = message->FindMessenger(
                       "observer", &observer);
    if(err < B_OK) {
        PRINT((
                  "* ObservableLooper::_handleRemoveObserver(): no observer specified!\n"));
        // send reply? +++++
        return;
    }

    // at this point, a reply of some sort will be sent
    reply.AddMessenger("target", BMessenger(this));
    reply.AddMessenger("observer", observer);

    int32 index = IndexOfTarget(observer.Target(0));
    if(index == -1) {
        reply.what = M_BAD_OBSERVER;
    }
    else {
        RemoveTarget(index);
        reply.what = M_OBSERVER_REMOVED;
    }

    message->SendReply(&reply);

    // call hook
    observerRemoved(observer);

    // time to shut down?
    if(m_quitting && !CountTargets()) {
        releaseComplete();
        BLooper::Quit();
    }
}
Пример #10
0
void
CCBServer::SendHeartbeatResponse( CCBTarget *target )
{
	Sock *sock = target->getSock();

	ClassAd msg;
	msg.Assign( ATTR_COMMAND, ALIVE );
	sock->encode();
	if( !msg.put( *sock ) || !sock->end_of_message() ) {
		dprintf(D_ALWAYS,
				"CCB: failed to send heartbeat to target "
				"daemon %s with ccbid %lu\n",
				target->getSock()->peer_description(),
				target->getCCBID());

		RemoveTarget( target );
		return;
	}
	dprintf(D_FULLDEBUG,"CCB: sent heartbeat to target %s\n",
			sock->peer_description());
}
Пример #11
0
void ObservableHandler::_handleRemoveObserver(
	BMessage*								message) {

#if DEBUG
	BLooper* l = Looper();
	ASSERT(l);
	ASSERT(l->IsLocked());
#endif
	BMessage reply;

	BMessenger observer;
	status_t err = message->FindMessenger(
		"observer", &observer);
	if(err < B_OK) {
		PRINT((
			"* ObservableHandler::_handleRemoveObserver(): no observer specified!\n"));
		// send reply? +++++
		return;
	}

	int32 index = IndexOfTarget(observer.Target(0));
	if(index == -1) {
		reply.what = M_BAD_OBSERVER;
		
		reply.AddMessenger("target", BMessenger(this));
		reply.AddMessenger("observer", observer);
		message->SendReply(&reply);
		return;
	}
	
	// valid observer given; remove it & call notification hook
	RemoveTarget(index);
	observerRemoved(observer);
	
	// time to shut down?
	if(m_released && !CountTargets()) {
		releaseComplete();
		delete this; // BOOM!
	}
}
Пример #12
0
Entity* TurretComponent::FindEntityTarget(std::function<bool(Entity&, Entity&)> CompareTargets) {
	// Delete old target.
	RemoveTarget();

	// Search best target.
	// TODO: Iterate over all valid targets, do not assume they have to be clients.
	ForEntities<ClientComponent>([&](Entity& candidate, ClientComponent& clientComponent) {
		if (TargetValid(candidate, true)) {
			if (!target || CompareTargets(candidate, *target->entity)) {
				target = candidate.oldEnt;
			}
		}
	});

	if (target) {
		// TODO: Increase tracked-by counter for a new target.

		turretLogger.Verbose("Target acquired.");
	}

	return target ? target->entity : nullptr;
}
Пример #13
0
TurretComponent::~TurretComponent() {
	// Make sure a target is removed eventually so tracked-by counters can be decreased.
	RemoveTarget();
}
Пример #14
0
int
CCBServer::HandleRegistration(int cmd,Stream *stream)
{
	ReliSock *sock = (ReliSock *)stream;
	ASSERT( cmd == CCB_REGISTER );

		// Avoid lengthy blocking on communication with our peer.
		// This command-handler should not get called until data
		// is ready to read.
	sock->timeout(1);

	ClassAd msg;
	sock->decode();
	if( !msg.initFromStream( *sock ) || !sock->end_of_message() ) {
		dprintf(D_ALWAYS,
				"CCB: failed to receive registration "
				"from %s.\n", sock->peer_description() );
		return FALSE;
	}

	SetSmallBuffers(sock);

	MyString name;
	if( msg.LookupString(ATTR_NAME,name) ) {
			// target daemon name is purely for debugging purposes
		name.formatstr_cat(" on %s",sock->peer_description());
		sock->set_peer_description(name.Value());
	}

	CCBTarget *target = new CCBTarget(sock);

	MyString reconnect_cookie_str,reconnect_ccbid_str;
	CCBID reconnect_cookie,reconnect_ccbid;
	bool reconnected = false;
	if( msg.LookupString(ATTR_CLAIM_ID,reconnect_cookie_str) &&
		CCBIDFromString(reconnect_cookie,reconnect_cookie_str.Value()) &&
		msg.LookupString( ATTR_CCBID,reconnect_ccbid_str) &&
		CCBIDFromContactString(reconnect_ccbid,reconnect_ccbid_str.Value()) )
	{
		target->setCCBID( reconnect_ccbid );
		reconnected = ReconnectTarget( target, reconnect_cookie );
	}

	if( !reconnected ) {
		AddTarget( target );
	}

	CCBReconnectInfo *reconnect_info = GetReconnectInfo( target->getCCBID() );
	ASSERT( reconnect_info );

	sock->encode();

	ClassAd reply_msg;
	MyString ccb_contact;
	CCBIDToString( reconnect_info->getReconnectCookie(),reconnect_cookie_str );
		// We send our address as part of the CCB contact string, rather
		// than letting the target daemon fill it in.  This is to give us
		// potential flexibility on the CCB server side to do things like
		// assign different targets to different CCB server sub-processes,
		// each with their own command port.
	CCBIDToContactString( m_address.Value(), target->getCCBID(), ccb_contact );

	reply_msg.Assign(ATTR_CCBID,ccb_contact.Value());
	reply_msg.Assign(ATTR_COMMAND,CCB_REGISTER);
	reply_msg.Assign(ATTR_CLAIM_ID,reconnect_cookie_str.Value());

	if( !reply_msg.put( *sock ) || !sock->end_of_message() ) {
		dprintf(D_ALWAYS,
				"CCB: failed to send registration response "
				"to %s.\n", sock->peer_description() );

		RemoveTarget( target );
		return KEEP_STREAM; // we have already closed this socket
	}

	return KEEP_STREAM;
}
Пример #15
0
void
CCBServer::HandleRequestResultsMsg( CCBTarget *target )
{
		// Reply from target daemon about whether it succeeded in
		// connecting to the requested client.

	Sock *sock = target->getSock();

	ClassAd msg;
	sock->decode();
	if( !msg.initFromStream( *sock ) || !sock->end_of_message() ) {
			// disconnect
		dprintf(D_FULLDEBUG,
				"CCB: received disconnect from target daemon %s "
				"with ccbid %lu.\n",
				sock->peer_description(), target->getCCBID() );
		RemoveTarget( target );
		return;
	}

	int command = 0;
	if( msg.LookupInteger( ATTR_COMMAND, command ) && command == ALIVE ) {
		SendHeartbeatResponse( target );
		return;
	}

	target->decPendingRequestResults();

	bool success = false;
	MyString error_msg;
	MyString reqid_str;
	CCBID reqid;
	MyString connect_id;
	msg.LookupBool( ATTR_RESULT, success );
	msg.LookupString( ATTR_ERROR_STRING, error_msg );
	msg.LookupString( ATTR_REQUEST_ID, reqid_str );
	msg.LookupString( ATTR_CLAIM_ID, connect_id );

	if( !CCBIDFromString( reqid, reqid_str.Value() ) ) {
		MyString msg_str;
		msg.sPrint(msg_str);
		dprintf(D_ALWAYS,
				"CCB: received reply from target daemon %s with ccbid %lu "
				"without a valid request id: %s\n",
				sock->peer_description(),
				target->getCCBID(),
				msg_str.Value());
		RemoveTarget( target );
		return;
	}

	CCBServerRequest *request = GetRequest( reqid );
	if( request && request->getSock()->readReady() ) {
		// Request socket must have just closed.  To avoid noise in
		// logs when we fail to write to it, delete the request now.
		RemoveRequest( request );
		request = NULL;
	}

	char const *request_desc = "(client which has gone away)";
	if( request ) {
		request_desc = request->getSock()->peer_description();
	}

	if( success ) {
		dprintf(D_FULLDEBUG,"CCB: received 'success' from target daemon %s "
				"with ccbid %lu for "
				"request %s from %s.\n",
				sock->peer_description(),
				target->getCCBID(),
				reqid_str.Value(),
				request_desc);
	}
	else {
		dprintf(D_FULLDEBUG,"CCB: received error from target daemon %s "
				"with ccbid %lu for "
				"request %s from %s: %s\n",
				sock->peer_description(),
				target->getCCBID(),
				reqid_str.Value(),
				request_desc,
				error_msg.Value());
	}

	if( !request ) {
		if( success ) {
				// expected: the client has gone away; it got what it wanted
			return;
		}
		dprintf( D_FULLDEBUG,
				 "CCB: client for request %s to target daemon %s with ccbid "
				 "%lu disappeared before receiving error details.\n",
				 reqid_str.Value(),
				 sock->peer_description(),
				 target->getCCBID());
		return;
	}
	if( connect_id != request->getConnectID() ) {
		MyString msg_str;
		msg.sPrint(msg_str);
		dprintf( D_FULLDEBUG,
				 "CCB: received wrong connect id (%s) from target daemon %s "
				 "with ccbid %lu for "
				 "request %s\n",
				 connect_id.Value(),
				 sock->peer_description(),
				 target->getCCBID(),
				 reqid_str.Value());
		RemoveTarget( target );
		return;
	}

	RequestFinished( request, success, error_msg.Value() );
}
Пример #16
0
// MSGRECEIVE
// receive trigger messages
bool plAGMasterMod::MsgReceive(plMessage* msg)
{
    plSDLNotificationMsg* nMsg = plSDLNotificationMsg::ConvertNoRef(msg);
    if (nMsg)
    {
        // Force a single eval
        plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
        return true;
    }

    plAnimCmdMsg* cmdMsg = plAnimCmdMsg::ConvertNoRef(msg);
    if (cmdMsg)
    {
        plString targetName = cmdMsg->GetAnimName();

        if (targetName.IsNull())
            targetName = ENTIRE_ANIMATION_NAME;

        plAGAnimInstance *inst = FindAnimInstance(targetName);
        if (inst != nil)
        {
            if (cmdMsg->CmdChangesAnimTime())
            {
                for (int i = 0; i < GetNumAnimations(); i++)
                {
                    plAGAnimInstance *currInst = GetAnimInstance(i);
                    if (currInst != inst && currInst->GetAnimation()->SharesPinsWith(inst->GetAnimation()))
                        currInst->SetBlend(0);
                }
                inst->SetBlend(1);
            }

            inst->HandleCmd(cmdMsg);
        }

        return true;
    }

    plAGCmdMsg* agMsg = plAGCmdMsg::ConvertNoRef(msg);
    if (agMsg)
    {
        if (agMsg->Cmd(plAGCmdMsg::kSetAnimTime))
        {
            for (int i = 0; i < fAnimInstances.size(); i++)
            {
                plAGAnimInstance *inst = fAnimInstances[i];
                inst->SetCurrentTime(agMsg->fAnimTime, true);
            }

            return true;
        }

        plAGAnimInstance *inst = FindAnimInstance(agMsg->GetAnimName());
        if (inst != nil)
        {
            if (agMsg->Cmd(plAGCmdMsg::kSetBlend))
                inst->Fade(agMsg->fBlend, agMsg->fBlendRate, plAGAnimInstance::kFadeBlend);
            if (agMsg->Cmd(plAGCmdMsg::kSetAmp))
                inst->Fade(agMsg->fAmp, agMsg->fAmpRate, plAGAnimInstance::kFadeAmp);
        }
        return true;
    }

    plAGInstanceCallbackMsg *agicMsg = plAGInstanceCallbackMsg::ConvertNoRef(msg);
    if (agicMsg)
    {
        if (agicMsg->fEvent == kStart)
        {
            IRegForEval(true);
        }
        else if (agicMsg->fEvent == kStop)
        {
            if (!HasRunningAnims())
                IRegForEval(false);
        }
        else // Just force a single eval
        {
            plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
        }
        return true;
    }

    plAGDetachCallbackMsg *detachMsg = plAGDetachCallbackMsg::ConvertNoRef(msg);
    if (detachMsg)
    {
        DetachAnimation(detachMsg->GetAnimName());
    }

    plGenRefMsg *genRefMsg = plGenRefMsg::ConvertNoRef(msg);
    if (genRefMsg)
    {
        plAGAnim *anim = plAGAnim::ConvertNoRef(genRefMsg->GetRef());
        if (anim)
        {
            if (genRefMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest))
            {
                if (genRefMsg->fType == kPrivateAnim)
                    fPrivateAnims.push_back(anim);
            }
            else
            {
                if (genRefMsg->fType == kPrivateAnim)
                {
                    plAnimVector::iterator i = fPrivateAnims.begin();
                    for ( ; i != fPrivateAnims.end(); i++)
                    {
                        plAGAnim *currAnim = *i;

                        if(currAnim == anim)
                        {
                            i = fPrivateAnims.erase(i);
                            break;
                        }
                    }
                }
            }

            return true;
        }

        plAGModifier *agmod = plAGModifier::ConvertNoRef(genRefMsg->GetRef());
        if (agmod)
        {
            if (genRefMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest))
                fChannelMods[agmod->GetChannelName()] = agmod;
            else
                fChannelMods.erase(agmod->GetChannelName());

            return true;
        }

        plMsgForwarder *msgfwd = plMsgForwarder::ConvertNoRef(genRefMsg->GetRef());
        if (msgfwd)
        {
            if (genRefMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest))
                fMsgForwarder = msgfwd;
            else
                fMsgForwarder = nil;

            return true;
        }
    }

    plRefMsg* refMsg = plRefMsg::ConvertNoRef(msg);
    if (refMsg)
    {
        if( refMsg->GetContext() & (plRefMsg::kOnCreate|plRefMsg::kOnRequest|plRefMsg::kOnReplace) )
            AddTarget(plSceneObject::ConvertNoRef(refMsg->GetRef()));
        else
            RemoveTarget(plSceneObject::ConvertNoRef(refMsg->GetRef()));

        return true;
    }

    return plModifier::MsgReceive(msg);
}
Пример #17
0
void Spell::FillTargetMap(uint32 i)
{
	//Spell::prepare() has already a m_caster->IsInWorld() check so if now the caster is no more in world something bad happened.
	ARCEMU_ASSERT(m_caster->IsInWorld());

	uint32 TargetType = 0;
	TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetA[i], i);

	//never get info from B if it is 0 :P
	if(m_spellInfo->EffectImplicitTargetB[i] != 0)
		TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetB[i], i);

	if(TargetType & SPELL_TARGET_NOT_IMPLEMENTED)
		return;
	if(TargetType & SPELL_TARGET_NO_OBJECT)  //summon spells that appear infront of caster
	{
		HandleTargetNoObject();
		return;
	}


	//always add this guy :P
	if(!(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF | SPELL_TARGET_AREA_CURTARGET | SPELL_TARGET_AREA_CONE | SPELL_TARGET_OBJECT_SELF | SPELL_TARGET_OBJECT_PETOWNER)))
	{
		Object* target = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget);
		AddTarget(i, TargetType, target);
	}

	if(TargetType & SPELL_TARGET_OBJECT_SELF)
		AddTarget(i, TargetType, m_caster);
	if(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF))  //targetted aoe
		AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
	//TODO: arcemu, doesn't support summon slots?
	/*if (TargetType & SPELL_TARGET_OBJECT_CURTOTEMS && u_caster != NULL)
		for (uint32 i=1; i<5; ++i) //totem slots are 1, 2, 3, 4
			AddTarget(i, TargetType, u_caster->m_summonslot[i]);*/
	if(TargetType & SPELL_TARGET_OBJECT_CURPET && p_caster != NULL)
		AddTarget(i, TargetType, p_caster->GetSummon());
	if(TargetType & SPELL_TARGET_OBJECT_PETOWNER)
	{
		uint64 guid = m_targets.m_unitTarget;
		if(GET_TYPE_FROM_GUID(guid) == HIGHGUID_TYPE_PET)
		{
			Pet* p = m_caster->GetMapMgr()->GetPet(GET_LOWGUID_PART(guid));

			if(p != NULL)
				AddTarget(i, TargetType, p->GetPetOwner());
		}
	}
	//targets party, not raid
	if((TargetType & SPELL_TARGET_AREA_PARTY) && !(TargetType & SPELL_TARGET_AREA_RAID))
	{
		if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
			AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
		else
			AddPartyTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //players/pets/totems
	}
	if(TargetType & SPELL_TARGET_AREA_RAID)
	{
		if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
			AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
		else
			AddRaidTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets, (TargetType & SPELL_TARGET_AREA_PARTY) ? true : false); //players/pets/totems
	}
	if(TargetType & SPELL_TARGET_AREA_CHAIN)
		AddChainTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
	//target cone
	if(TargetType & SPELL_TARGET_AREA_CONE)
		AddConeTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

	if(TargetType & SPELL_TARGET_OBJECT_SCRIPTED)
		AddScriptedOrSpellFocusTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
		
	//Mind Sear hackz
	if(GetProto()->Id == 53022 || GetProto()->Id == 49821)
	{
		Object* target = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget);
		RemoveTarget(i, target);
	}
}