uint processEvent( const TDataSetRow & userRow, const CMissionEvent & event,uint subStepIndex,const TDataSetRow & giverRow ) { if ( event.Type == CMissionEvent::Kill ) { CMissionStepKillByName & eventSpe = (CMissionStepKillByName&)event; CCreature * c = CreatureManager.getCreature( event.TargetEntity ); if ( !c ) { LOGMISSIONSTEPERROR("kill_npc_by_name : invalid creature " + toString(event.TargetEntity.getIndex())); } else { if ( (GroupKill && Aliases.find(c->getAIGroupAlias()) != Aliases.end()) || Aliases.find( c->getAlias() ) != Aliases.end() ) { 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, ®ion , &continent ) ) return 0; if ( continent && continent->getId() == Place ) { LOGMISSIONSTEPSUCCESS("kill_npc_by_name"); return 1; } if ( region && region->getId() == Place ) { LOGMISSIONSTEPSUCCESS("kill_npc_by_name"); return 1; } for ( uint i = 0; i < places.size(); i++ ) { if ( places[i] && places[i]->getId() == Place ) { LOGMISSIONSTEPSUCCESS("kill_npc_by_name"); return 1; } } return 0; } else { LOGMISSIONSTEPSUCCESS("kill_npc_by_name"); return 1; } } } } return 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_fauna : invalid creature " + toString(event.TargetEntity.getIndex())); } else if ( _SubSteps[subStepIndex].Sheet == c->getType() ) { 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, ®ion , &continent ) ) return 0; if ( region && region->getId() == _Place ) { LOGMISSIONSTEPSUCCESS("kill_fauna"); return 1; } for ( uint i = 0; i < places.size(); i++ ) { if ( places[i] && places[i]->getId() == _Place ) { LOGMISSIONSTEPSUCCESS("kill_fauna"); return 1; } } return 0; } else { LOGMISSIONSTEPSUCCESS("kill_fauna"); return 1; } } } return 0; }