コード例 #1
0
 /// <summary>
 /// Requests an invite to a raid for a player.
 /// </summary>
 /// <param name="player">Player that requested the invite.</param>
 public override void RequestInvite(SocketGuildUser player)
 {
     if (IsInRaid(player) == Global.NOT_IN_RAID)
     {
         Invite.Add(player);
     }
 }
コード例 #2
0
        /// <summary>
        /// Removes a player from the raid.
        /// </summary>
        /// <param name="player">Player to remove.</param>
        /// <returns>RaidRemove with raid group and list of invited users.</returns>
        public override RaidRemoveResult RemovePlayer(SocketGuildUser player)
        {
            RaidRemoveResult returnValue = new RaidRemoveResult(Global.NOT_IN_RAID, new List <SocketGuildUser>());

            int groupNum = IsInRaid(player);

            if (groupNum == InviteListNumber)
            {
                Invite.Remove(player);
            }
            else if (groupNum == MuleGroupNumber)
            {
                Mules.RemovePlayer(player);
                foreach (RaidGroup group in Groups)
                {
                    returnValue.Users.AddRange(group.RemovePlayer(player));
                }
                foreach (SocketGuildUser invite in returnValue.Users)
                {
                    Invite.Add(invite);
                }
                return(returnValue);
            }
            else if (groupNum != Global.NOT_IN_RAID)
            {
                RaidGroup foundGroup = Groups.ElementAt(groupNum);
                foundGroup.RemovePlayer(player);
            }
            return(returnValue);
        }
コード例 #3
0
ファイル: Raid.cs プロジェクト: otooleam/Nona
        /// <summary>
        /// Removes a player from the raid.
        /// </summary>
        /// <param name="player">Player to remove.</param>
        /// <returns>RaidRemove with raid group and list of invited users.</returns>
        public override RaidRemoveResult RemovePlayer(SocketGuildUser player)
        {
            RaidRemoveResult returnValue = new RaidRemoveResult(Global.NOT_IN_RAID, new List <SocketGuildUser>());

            int group = IsInRaid(player);

            if (group == InviteListNumber)
            {
                Invite.Remove(player);
            }
            else
            {
                if (group != Global.NOT_IN_RAID)
                {
                    RaidGroup foundGroup            = Groups.ElementAt(group);
                    List <SocketGuildUser> tempList = foundGroup.RemovePlayer(player);
                    foreach (SocketGuildUser invite in tempList)
                    {
                        returnValue.Users.Add(invite);
                        Invite.Add(invite);
                    }
                }
            }
            return(returnValue);
        }
コード例 #4
0
        /// <summary>
        /// Adds a player to a raid.
        /// The player will not be added if splitting the group brings the number of
        /// raid groups over the group limit.
        /// </summary>
        /// <param name="player">Player to add.</param>
        /// <param name="partySize">Number of accounts the player is bringing. Should always be 1.</param>
        /// <param name="invitedBy">Who invited the user.</param>
        /// <returns>True if the user was added, otherwise false.</returns>
        public override bool AddPlayer(SocketGuildUser player, int partySize, SocketGuildUser invitedBy = null)
        {
            if (invitedBy == null)
            {
                if (IsInRaid(player) == Global.NOT_IN_RAID && Mules.GetAttendingCount() < Global.LIMIT_RAID_MULE_MULE)
                {
                    Mules.AddPlayer(player, partySize, Global.NO_ADD_VALUE);
                    return(true);
                }
            }
            else // is invite
            {
                int group = FindSmallestGroup();
                Groups.ElementAt(group).InvitePlayer(player, invitedBy);
                Invite.Remove(player);

                bool shouldSplit = Groups.ElementAt(group).ShouldSplit();

                if (shouldSplit && Groups.Count < RaidGroupLimit)
                {
                    RaidGroup newGroup = Groups.ElementAt(group).SplitGroup();
                    Groups.Add(newGroup);
                    CheckMergeGroups();
                    return(true);
                }
                else if (!shouldSplit)
                {
                    CheckMergeGroups();
                    return(true);
                }

                Groups.ElementAt(group).RemovePlayer(player);
                Invite.Add(player);
            }
            return(false);
        }
コード例 #5
0
ファイル: Raid.cs プロジェクト: otooleam/Nona
        /// <summary>
        /// Adds a player to a raid.
        /// The player will not be added if splitting the group brings the number of
        /// raid groups over the group limit.
        /// </summary>
        /// <param name="player">Player to add.</param>
        /// <param name="partySize">Number of accounts the player is bringing.</param>
        /// <param name="invitedBy">Who invited the player.</param>
        /// <returns>True if the player was added, otherwise false.</returns>
        public override bool AddPlayer(SocketGuildUser player, int partySize, SocketGuildUser invitedBy = null)
        {
            int group;

            if (invitedBy == null) // Add in person
            {
                group = IsInRaid(player);
                if (group == Global.NOT_IN_RAID)
                {
                    group = FindSmallestGroup();
                }
                if (group != InviteListNumber)
                {
                    Groups.ElementAt(group).AddPlayer(player, partySize, Global.NO_ADD_VALUE);
                }
                else
                {
                    return(false);
                }
            }
            else if (player.Equals(invitedBy)) // Remote
            {
                group = IsInRaid(player);
                if (group == Global.NOT_IN_RAID)
                {
                    group = FindSmallestGroup();
                }
                if (group != InviteListNumber)
                {
                    Groups.ElementAt(group).AddPlayer(player, Global.NO_ADD_VALUE, partySize);
                }
                else
                {
                    return(false);
                }
            }
            else // accept invite
            {
                group = IsInRaid(invitedBy);
                if (group != Global.NOT_IN_RAID)
                {
                    Groups.ElementAt(group).InvitePlayer(player, invitedBy);
                    Invite.Remove(player);
                }
                else if (player.Equals(invitedBy))
                {
                    group = FindSmallestGroup();
                    Groups.ElementAt(group).InvitePlayer(player, invitedBy);
                }
                else
                {
                    return(false);
                }
            }

            bool shouldSplit = Groups.ElementAt(group).ShouldSplit();

            if (shouldSplit && Groups.Count < RaidGroupLimit)
            {
                RaidGroup newGroup = Groups.ElementAt(group).SplitGroup();
                Groups.Add(newGroup);
                CheckMergeGroups();
                return(true);
            }
            else if (!shouldSplit)
            {
                CheckMergeGroups();
                return(true);
            }

            Groups.ElementAt(group).RemovePlayer(player);
            if (invitedBy != null)
            {
                Invite.Add(player);
            }
            return(false);
        }