/// <summary> /// Returns all online Characters in a <see cref="SynchronizedCharacterList"/>. /// </summary> /// <returns></returns> public SynchronizedCharacterList GetCharacterSet() { var chrs = new SynchronizedCharacterList(m_Count, FactionGroup); using (syncLock.EnterReadLock()) { for (var i = 0; i < SubGroups.Length; i++) { var subGroup = SubGroups[i]; foreach (var member in subGroup) { if (member.Character != null) { chrs.Add(member.Character); } } } } return(chrs); }
/// <summary> /// Returns all online Characters in a <see cref="T:WCell.RealmServer.Entities.SynchronizedCharacterList" />. /// </summary> /// <returns></returns> public SynchronizedCharacterList GetCharacterSet() { SynchronizedCharacterList synchronizedCharacterList = new SynchronizedCharacterList(m_Count, FactionGroup); using (syncLock.EnterReadLock()) { for (int index = 0; index < SubGroups.Length; ++index) { foreach (GroupMember groupMember in SubGroups[index]) { if (groupMember.Character != null) { synchronizedCharacterList.Add(groupMember.Character); } } } } return(synchronizedCharacterList); }
public ICharacterSet GetCharacterSet(Character chr, bool asGroup) { if (asGroup) { Group group = chr.Group; if (group == null || !group.IsLeader(chr)) { GroupHandler.SendResult((IPacketReceiver)chr, GroupResult.DontHavePermission); } else { Character[] allCharacters = group.GetAllCharacters(); if (allCharacters.Length == 0) { return((ICharacterSet)chr); } if (allCharacters.Length > this._parentQueue.Template.MaxPlayersPerTeam) { BattlegroundHandler.SendBattlegroundError((IPacketReceiver)chr, BattlegroundJoinError.GroupJoinedNotEligible); return((ICharacterSet)null); } foreach (Character character in allCharacters) { if (character != null && character.Battlegrounds.IsDeserter) { BattlegroundHandler.SendBattlegroundError((IPacketReceiver)group, BattlegroundJoinError.Deserter); return((ICharacterSet)null); } } SynchronizedCharacterList synchronizedCharacterList = new SynchronizedCharacterList(this.Side.GetFactionGroup()); foreach (Character chr1 in allCharacters) { if (chr1.IsInWorld && (chr1.GodMode || this._parentQueue.CanEnter(chr1))) { synchronizedCharacterList.Add(chr1); } else { BattlegroundHandler.SendBattlegroundError((IPacketReceiver)chr1, BattlegroundJoinError.GroupJoinedNotEligible); } } return((ICharacterSet)synchronizedCharacterList); } } else { if (!chr.Battlegrounds.IsDeserter) { return((ICharacterSet)chr); } BattlegroundHandler.SendBattlegroundError((IPacketReceiver)chr, BattlegroundJoinError.Deserter); } return((ICharacterSet)null); }
public ICharacterSet GetCharacterSet(Character chr, bool asGroup) { // we are working with a non-synchronized Character object here if (asGroup) { var group = chr.Group; if (group == null || !group.IsLeader(chr)) { // invalid request GroupHandler.SendResult(chr, GroupResult.DontHavePermission); } else { var chrs = group.GetAllCharacters(); // if no characters in the group, return the original character if (chrs.Length == 0) return chr; // make sure the group isn't bigger than the max team size for this BG if (chrs.Length > _parentQueue.Template.MaxPlayersPerTeam) { BattlegroundHandler.SendBattlegroundError(chr, BattlegroundJoinError.GroupJoinedNotEligible); return null; } // make sure there are no deserters foreach(Character groupChr in chrs) { if (groupChr != null && groupChr.Battlegrounds.IsDeserter) { BattlegroundHandler.SendBattlegroundError(group, BattlegroundJoinError.Deserter); return null; } } var list = new SynchronizedCharacterList(Side.GetFactionGroup()); foreach(var groupChr in chrs) { if (groupChr.IsInWorld && (groupChr.GodMode || _parentQueue.CanEnter(groupChr))) { list.Add(groupChr); } else { // cannot join the same team BattlegroundHandler.SendBattlegroundError(groupChr, BattlegroundJoinError.GroupJoinedNotEligible); } } return list; } } else { // enqueue the character if they aren't a deserter if (!chr.Battlegrounds.IsDeserter) return chr; BattlegroundHandler.SendBattlegroundError(chr, BattlegroundJoinError.Deserter); } return null; }
/// <summary> /// Returns all online Characters in a <see cref="SynchronizedCharacterList"/>. /// </summary> /// <returns></returns> public SynchronizedCharacterList GetCharacterSet() { var chrs = new SynchronizedCharacterList(m_Count, FactionGroup); m_syncLock.EnterReadLock(); try { for (var i = 0; i < SubGroups.Length; i++) { var subGroup = SubGroups[i]; foreach (var member in subGroup) { if (member.Character != null) { chrs.Add(member.Character); } } } } finally { m_syncLock.ExitReadLock(); } return chrs; }
public ICharacterSet GetCharacterSet(Character chr, bool asGroup) { // we are working with a non-synchronized Character object here if (asGroup) { var group = chr.Group; if (group == null || !group.IsLeader(chr)) { // invalid request GroupHandler.SendResult(chr, GroupResultType.Swap, GroupResult.DontHavePermission); } else { var chrs = group.GetAllCharacters(); // if no characters in the group, return the original character if (chrs.Length == 0) { return(chr); } // make sure the group isn't bigger than the max team size for this BG if (chrs.Length > _parentQueue.Template.MaxPlayersPerTeam) { BattlegroundHandler.SendBattlegroundError(chr, BattlegroundJoinError.GroupJoinedNotEligible); return(null); } // make sure there are no deserters foreach (Character groupChr in chrs) { if (groupChr != null && groupChr.Battlegrounds.IsDeserter) { BattlegroundHandler.SendBattlegroundError(group, BattlegroundJoinError.Deserter); return(null); } } var list = new SynchronizedCharacterList(Side.GetFactionGroup()); foreach (var groupChr in chrs) { if (groupChr.IsInWorld && (groupChr.GodMode || _parentQueue.CanEnter(groupChr))) { list.Add(groupChr); } else { // cannot join the same team BattlegroundHandler.SendBattlegroundError(groupChr, BattlegroundJoinError.GroupJoinedNotEligible); } } return(list); } } else { // enqueue the character if they aren't a deserter if (!chr.Battlegrounds.IsDeserter) { return(chr); } BattlegroundHandler.SendBattlegroundError(chr, BattlegroundJoinError.Deserter); } return(null); }