public static void SendPacketToGang(this IZone zone, Gang gang, Packet packet, long exceptMemberEid = 0L) { zone.GetGangMembers(gang).Where(player => player.Eid != exceptMemberEid).ForEach(p => { p.Session.SendPacket(packet); }); }
/// <summary> /// Filters and enqueues a mission event info /// /// This is where all zone targers pushed in for proccessing /// </summary> /// <param name="missionEventInfo"></param> public void EnqueueMissionEventInfo(MissionEventInfo missionEventInfo) { var mycharacter = _player.Character; var gang = _player.Gang; if (gang == null) { //enqueue for myself EnqueueMissionEventInfoLocally(missionEventInfo); return; } var membersOnZone = _zone.GetGangMembers(gang).ToList(); /* * if (missionEventInfo.MissionTargetType == MissionTargetType.drill_mineral || * missionEventInfo.MissionTargetType == MissionTargetType.harvest_plant || * missionEventInfo.MissionTargetType == MissionTargetType.scan_mineral * ) * */ // check myself first if (AnyTargetForEventInfo(missionEventInfo)) { #if DEBUG Logger.Info(" >>>> doer has the target, he comes first. " + _player.Character.Id + " " + missionEventInfo.MissionTargetType); #endif EnqueueMissionEventInfoLocally(missionEventInfo); return; } foreach (var member in membersOnZone) { if (member.Character.Equals(mycharacter)) { continue; //except for myself } if (member.MissionHandler.AnyTargetForEventInfo(missionEventInfo)) { #if DEBUG Logger.Info(" >>>> gm has it! " + member.Character.Id + " " + missionEventInfo.MissionTargetType); #endif member.MissionHandler.EnqueueMissionEventInfoLocally(missionEventInfo); return; } } #if DEBUG // pop_npc and reach position is always submitted to every gang member - don't log it if (!(missionEventInfo.MissionTargetType == MissionTargetType.pop_npc || missionEventInfo.MissionTargetType == MissionTargetType.reach_position)) { Logger.Warning(" >>>> ALL. " + _player.Character.Id + " " + missionEventInfo.MissionTargetType); } #endif //members including me foreach (var member in _zone.GetGangMembers(gang)) { //ok, enqueue locally so he wont's spread it again to his gang members member.MissionHandler.EnqueueMissionEventInfoLocally(missionEventInfo); } }
protected override IEnumerable <Unit> GetTargets(IZone zone) { var player = (Player)Owner; return(zone.GetGangMembers(player.Gang).WithinRange(Owner.CurrentPosition, Radius)); }