示例#1
0
	uint processEvent( const TDataSetRow & userRow, const CMissionEvent & event,uint subStepIndex,const TDataSetRow & giverRow )
	{
		if ( event.Type == CMissionEvent::Kill )
		{
			CMissionEventKill & eventSpe = (CMissionEventKill&)event;
			CCreature * c = CreatureManager.getCreature( event.TargetEntity );
			if ( !c )
			{
				LOGMISSIONSTEPERROR("kill_race : invalid creature " + toString(event.TargetEntity.getIndex()));
			}
			else if ( _SubSteps[subStepIndex].Race == c->getRace() )
			{
				if ( _Place != 0xFFFF )
				{
					float gooDistance;
					const CPlace * stable = NULL;
					std::vector<const CPlace *> places;
					const CRegion * region = NULL;
					const CContinent * continent = NULL;
					if ( !CZoneManager::getInstance().getPlace( c->getState().X, c->getState().Y, gooDistance, &stable, places, &region , &continent ) )
						return 0;
					if ( continent && continent->getId() == _Place )
					{
						LOGMISSIONSTEPSUCCESS("kill_race");
						return 1;
					}
					if ( region && region->getId() == _Place )
					{
						LOGMISSIONSTEPSUCCESS("kill_race");
						return 1;
					}
					for ( uint i = 0; i < places.size(); i++ )
					{
						if ( places[i] && places[i]->getId() == _Place )
						{
							LOGMISSIONSTEPSUCCESS("kill_race");
							return 1;
						}
					}
					return 0;
				}
				else
				{
					LOGMISSIONSTEPSUCCESS("kill_race");
					return 1;
				}
			}
		}
		return 0;
	}