GetFlag() public méthode

public GetFlag ( RankFlags flag ) : bool
flag RankFlags
Résultat bool
Exemple #1
0
        public void CreateAlliance_Callback(Mobile from, string text)
        {
            PlayerMobile pm = from as PlayerMobile;

            AllianceInfo alliance      = guild.Alliance;
            AllianceInfo otherAlliance = m_Other.Alliance;

            if (!IsMember(from, guild) || alliance != null)
            {
                return;
            }

            RankDefinition playerRank = pm.GuildRank;

            if (!playerRank.GetFlag(RankFlags.AllianceControl))
            {
                pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance.
            }
            else if (otherAlliance != null)
            {
                // ~1_val~ is currently considering another alliance proposal. | // ~1_val~ already belongs to an alliance.
                pm.SendLocalizedMessage(otherAlliance.IsPendingMember(m_Other) ? 1063416 : 1063426, m_Other.Name);
            }
            else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
            {
                pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war.
            }
            else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
            {
                pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war.
            }
            else
            {
                string name = Utility.FixHtml(text.Trim());

                if (!CheckProfanity(name))
                {
                    pm.SendLocalizedMessage(1070886); // That alliance name is not allowed.
                }
                else if (name.Length > Guild.NameLimit)
                {
                    pm.SendLocalizedMessage(1070887, Guild.NameLimit.ToString()); // An alliance name cannot exceed ~1_val~ characters in length.
                }
                else if (AllianceInfo.Alliances.ContainsKey(name.ToLower()))
                {
                    pm.SendLocalizedMessage(1063428); // That alliance name is not available.
                }
                else
                {
                    pm.SendLocalizedMessage(1070750, m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~.

                    m_Other.GuildMessage(1070780, guild.Name);      // ~1_val~ has proposed an alliance.

                    new AllianceInfo(guild, name, m_Other);
                }
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (pm == null || !IsMember(pm, guild) || !IsMember(m_Member, guild))
            {
                return;
            }

            RankDefinition playerRank = pm.GuildRank;
            RankDefinition targetRank = m_Member.GuildRank;

            switch (info.ButtonID)
            {
            case 1:     //Promote
            {
                if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && ((playerRank.Rank - 1) > targetRank.Rank || (playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank)))
                {
                    targetRank = RankDefinition.Ranks[targetRank.Rank + 1];

                    if (targetRank == RankDefinition.Leader)
                    {
                        if (m_ToLeader)
                        {
                            m_Member.GuildRank = targetRank;
                            pm.SendLocalizedMessage(1063156, m_Member.Name);   // The guild information for ~1_val~ has been updated.
                            pm.SendLocalizedMessage(1063156, pm.Name);         // The guild information for ~1_val~ has been updated.
                            guild.Leader = m_Member;
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1063144);         // Are you sure you wish to make this member the new guild leader?
                            pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, false, true));
                        }
                    }
                    else
                    {
                        m_Member.GuildRank = targetRank;
                        pm.SendLocalizedMessage(1063156, m_Member.Name);         // The guild information for ~1_val~ has been updated.
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(1063143);         // You don't have permission to promote this member.
                }
                break;
            }

            case 2:     //Demote
            {
                if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && playerRank.Rank > targetRank.Rank)
                {
                    if (targetRank == RankDefinition.Lowest)
                    {
                        if (RankDefinition.Lowest.Name.Number == 1062963)
                        {
                            pm.SendLocalizedMessage(1063333);         // You can't demote a ronin.
                        }
                        else
                        {
                            pm.SendMessage("You can't demote a {0}.", RankDefinition.Lowest.Name);
                        }
                    }
                    else
                    {
                        m_Member.GuildRank = RankDefinition.Ranks[targetRank.Rank - 1];
                        pm.SendLocalizedMessage(1063156, m_Member.Name);         // The guild information for ~1_val~ has been updated.
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(1063146);         // You don't have permission to demote this member.
                }
                break;
            }

            case 3:     //Set Guild title
            {
                if (playerRank.GetFlag(RankFlags.CanSetGuildTitle) && (playerRank.Rank > targetRank.Rank || m_Member == player))
                {
                    pm.SendLocalizedMessage(1011128);         // Enter the new title for this guild member or 'none' to remove a title:

                    pm.BeginPrompt(new PromptCallback(SetTitle_Callback));
                }
                else if (m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0)
                {
                    pm.SendLocalizedMessage(1070746);         // You don't have the permission to set that member's guild title.
                }
                else
                {
                    pm.SendLocalizedMessage(1063148);         // You don't have permission to change this member's guild title.
                }

                break;
            }

            case 4:     //Vote
            {
                if (m_Member == pm.GuildFealty && guild.Leader != m_Member)
                {
                    pm.SendLocalizedMessage(1063158);    // You have cleared your vote for guild leader.
                }
                else if (guild.CanVote(m_Member))        //( playerRank.GetFlag( RankFlags.CanVote ) )
                {
                    if (m_Member == guild.Leader)
                    {
                        pm.SendLocalizedMessage(1063424);         // You can't vote for the current guild leader.
                    }
                    else if (!guild.CanBeVotedFor(m_Member))
                    {
                        pm.SendLocalizedMessage(1063425);         // You can't vote for an inactive guild member.
                    }
                    else
                    {
                        pm.GuildFealty = m_Member;
                        pm.SendLocalizedMessage(1063159, m_Member.Name);         // You cast your vote for ~1_val~ for guild leader.
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(1063149);         // You don't have permission to vote.
                }
                break;
            }

            case 5:     //Kick
            {
                if ((playerRank.GetFlag(RankFlags.RemovePlayers) && playerRank.Rank > targetRank.Rank) || (playerRank.GetFlag(RankFlags.RemoveLowestRank) && targetRank == RankDefinition.Lowest))
                {
                    if (m_toKick)
                    {
                        guild.RemoveMember(m_Member);
                        pm.SendLocalizedMessage(1063157);         // The member has been removed from your guild.
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1063152);         // Are you sure you wish to kick this member from the guild?
                        pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, true, false));
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(1063151);         // You don't have permission to remove this member.
                }
                break;
            }
            }
        }
Exemple #3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (!IsMember(pm, guild))
            {
                return;
            }

            RankDefinition playerRank = pm.GuildRank;

            Guild guildLeader = Guild.GetAllianceLeader(guild);
            Guild otherGuild  = Guild.GetAllianceLeader(m_Other);

            WarDeclaration war       = guildLeader.FindPendingWar(otherGuild);
            WarDeclaration activeWar = guildLeader.FindActiveWar(otherGuild);
            WarDeclaration otherWar  = otherGuild.FindPendingWar(guildLeader);

            AllianceInfo alliance      = guild.Alliance;
            AllianceInfo otherAlliance = otherGuild.Alliance;

            switch (info.ButtonID)
            {
                #region War
            case 5:                     //Accept the war
            {
                if (war != null && !war.WarRequester && activeWar == null)
                {
                    if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                    {
                        pm.SendLocalizedMessage(1063440);                                   // You don't have permission to negotiate wars.
                    }
                    else if (alliance != null && alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));   // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else
                    {
                        //Accept the war
                        guild.PendingWars.Remove(war);
                        war.WarBeginning = DateTime.UtcNow;
                        guild.AcceptedWars.Add(war);

                        if (alliance != null && alliance.IsMember(guild))
                        {
                            alliance.AllianceMessage(1070769, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));                                       // Guild Message: Your guild is now at war with ~1_GUILDNAME~
                            alliance.InvalidateMemberProperties();
                        }
                        else
                        {
                            guild.GuildMessage(1070769, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));                                       // Guild Message: Your guild is now at war with ~1_GUILDNAME~
                            guild.InvalidateMemberProperties();
                        }
                        //Technically  SHOULD say Your guild is now at war w/out any info, intentional diff.

                        otherGuild.PendingWars.Remove(otherWar);
                        otherWar.WarBeginning = DateTime.UtcNow;
                        otherGuild.AcceptedWars.Add(otherWar);

                        if (otherAlliance != null && m_Other.Alliance.IsMember(m_Other))
                        {
                            otherAlliance.AllianceMessage(1070769, ((alliance != null) ? alliance.Name : guild.Name));                                       // Guild Message: Your guild is now at war with ~1_GUILDNAME~
                            otherAlliance.InvalidateMemberProperties();
                        }
                        else
                        {
                            otherGuild.GuildMessage(1070769, ((alliance != null) ? alliance.Name : guild.Name));                                       // Guild Message: Your guild is now at war with ~1_GUILDNAME~
                            otherGuild.InvalidateMemberProperties();
                        }
                    }
                }

                break;
            }

            case 6:                     //Modify war terms
            {
                if (war != null && !war.WarRequester && activeWar == null)
                {
                    if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                    {
                        pm.SendLocalizedMessage(1063440);                                   // You don't have permission to negotiate wars.
                    }
                    else if (alliance != null && alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));   // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else
                    {
                        pm.SendGump(new WarDeclarationGump(pm, guild, otherGuild));
                    }
                }
                break;
            }

            case 7:                     //Dismiss war
            {
                if (war != null)
                {
                    if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                    {
                        pm.SendLocalizedMessage(1063440);                                   // You don't have permission to negotiate wars.
                    }
                    else if (alliance != null && alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));   // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else
                    {
                        //Dismiss the war
                        guild.PendingWars.Remove(war);
                        otherGuild.PendingWars.Remove(otherWar);
                        pm.SendLocalizedMessage(1070752);                                   // The proposal has been updated.
                        //Messages to opposing guild? (Testing on OSI says no)
                    }
                }
                break;
            }

            case 8:                     //Surrender
            {
                if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                {
                    pm.SendLocalizedMessage(1063440);                               // You don't have permission to negotiate wars.
                }
                else if (alliance != null && alliance.Leader != guild)
                {
                    pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
                    pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                 // You need to negotiate via ~1_val~ instead.
                }
                else
                {
                    if (activeWar != null)
                    {
                        if (alliance != null && alliance.IsMember(guild))
                        {
                            alliance.AllianceMessage(1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));                                      // You have lost the war with ~1_val~.
                            alliance.InvalidateMemberProperties();
                        }
                        else
                        {
                            guild.GuildMessage(1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name));                                      // You have lost the war with ~1_val~.
                            guild.InvalidateMemberProperties();
                        }

                        guild.AcceptedWars.Remove(activeWar);

                        if (otherAlliance != null && otherAlliance.IsMember(otherGuild))
                        {
                            otherAlliance.AllianceMessage(1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name));                                      // You have won the war against ~1_val~!
                            otherAlliance.InvalidateMemberProperties();
                        }
                        else
                        {
                            otherGuild.GuildMessage(1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name));                                      // You have won the war against ~1_val~!
                            otherGuild.InvalidateMemberProperties();
                        }

                        otherGuild.AcceptedWars.Remove(otherGuild.FindActiveWar(guild));
                    }
                }
                break;
            }

            case 1:                     //Declare War
            {
                if (war == null && activeWar == null)
                {
                    if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                    {
                        pm.SendLocalizedMessage(1063440);                                   // You don't have permission to negotiate wars.
                    }
                    else if (alliance != null && alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));   // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else if (otherAlliance != null && otherAlliance.Leader != m_Other)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", m_Other.Name, otherAlliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
                        pm.SendLocalizedMessage(1070707, otherAlliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                    }
                    else
                    {
                        pm.SendGump(new WarDeclarationGump(pm, guild, m_Other));
                    }
                }
                break;
            }

                #endregion
            case 2:                     //Request Alliance
            {
                #region New alliance
                if (alliance == null)
                {
                    if (!playerRank.GetFlag(RankFlags.AllianceControl))
                    {
                        pm.SendLocalizedMessage(1070747);                                   // You don't have permission to create an alliance.
                    }
                    else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
                    {
                        pm.SendLocalizedMessage(1070758);                                   // You cannot propose an alliance to a guild with a different faction allegiance.
                    }
                    else if (otherAlliance != null)
                    {
                        if (otherAlliance.IsPendingMember(m_Other))
                        {
                            pm.SendLocalizedMessage(1063416, m_Other.Name);                                       // ~1_val~ is currently considering another alliance proposal.
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1063426, m_Other.Name);                                       // ~1_val~ already belongs to an alliance.
                        }
                    }
                    else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
                    {
                        pm.SendLocalizedMessage(1063427, m_Other.Name);                                   // ~1_val~ is currently involved in a guild war.
                    }
                    else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
                    {
                        pm.SendLocalizedMessage(1063427, guild.Name);                                   // ~1_val~ is currently involved in a guild war.
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1063439);                                   // Enter a name for the new alliance:
                        pm.BeginPrompt(new PromptCallback(CreateAlliance_Callback));
                    }
                }
                #endregion
                #region Existing Alliance
                else
                {
                    if (!playerRank.GetFlag(RankFlags.AllianceControl))
                    {
                        pm.SendLocalizedMessage(1063436);                                   // You don't have permission to negotiate an alliance.
                    }
                    else if (alliance.Leader != guild)
                    {
                        pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));                                     // ~1_val~ is not the leader of the ~2_val~ alliance.
                    }
                    else if (otherAlliance != null)
                    {
                        if (otherAlliance.IsPendingMember(m_Other))
                        {
                            pm.SendLocalizedMessage(1063416, m_Other.Name);                                       // ~1_val~ is currently considering another alliance proposal.
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1063426, m_Other.Name);                                       // ~1_val~ already belongs to an alliance.
                        }
                    }
                    else if (alliance.IsPendingMember(guild))
                    {
                        pm.SendLocalizedMessage(1063416, guild.Name);                                   // ~1_val~ is currently considering another alliance proposal.
                    }
                    else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0)
                    {
                        pm.SendLocalizedMessage(1063427, m_Other.Name);                                   // ~1_val~ is currently involved in a guild war.
                    }
                    else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0)
                    {
                        pm.SendLocalizedMessage(1063427, guild.Name);                                   // ~1_val~ is currently involved in a guild war.
                    }
                    else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader))
                    {
                        pm.SendLocalizedMessage(1070758);                                   // You cannot propose an alliance to a guild with a different faction allegiance.
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1070750, m_Other.Name);                 // An invitation to join your alliance has been sent to ~1_val~.

                        m_Other.GuildMessage(1070780, guild.Name);                      // ~1_val~ has proposed an alliance.

                        m_Other.Alliance = alliance;                                    //Calls addPendingGuild
                        //alliance.AddPendingGuild( m_Other );
                    }
                }
                #endregion
                break;
            }

            case 10:                            //Show Alliance Roster
            {
                if (alliance != null && alliance == otherAlliance)
                {
                    pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, alliance));
                }

                break;
            }

            case 11:                            //Leave Alliance
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && alliance.IsMember(guild))
                {
                    guild.Alliance = null;                              //Calls alliance.Removeguild
//						alliance.RemoveGuild( guild );

                    m_Other.InvalidateWarNotoriety();

                    guild.InvalidateMemberNotoriety();
                }
                break;
            }

            case 12:                            //Remove Guild from alliance
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && alliance.Leader != guild)
                {
                    pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));                                 // ~1_val~ is not the leader of the ~2_val~ alliance.
                }
                else if (alliance != null && alliance.IsMember(guild) && alliance.IsMember(m_Other))
                {
                    m_Other.Alliance = null;

                    m_Other.InvalidateMemberNotoriety();

                    guild.InvalidateWarNotoriety();
                }
                break;
            }

            case 13:                            //Promote to Alliance leader
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && alliance.Leader != guild)
                {
                    pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name));                                 // ~1_val~ is not the leader of the ~2_val~ alliance.
                }
                else if (alliance != null && alliance.IsMember(guild) && alliance.IsMember(m_Other))
                {
                    pm.SendLocalizedMessage(1063434, String.Format("{0}\t{1}", m_Other.Name, alliance.Name));                                 // ~1_val~ is now the leader of ~2_val~.

                    alliance.Leader = m_Other;
                }
                break;
            }

            case 14:                            //Withdraw Request
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && alliance.Leader == guild && alliance.IsPendingMember(m_Other))
                {
                    m_Other.Alliance = null;
                    pm.SendLocalizedMessage(1070752);                               // The proposal has been updated.
                }
                break;
            }

            case 15:                     //Deny Alliance Request
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (alliance != null && otherAlliance != null && alliance.Leader == m_Other && otherAlliance.IsPendingMember(guild))
                {
                    pm.SendLocalizedMessage(1070752);                               // The proposal has been updated.
                    //m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal.	//Per OSI commented out.

                    guild.Alliance = null;
                }
                break;
            }

            case 16:                     //Accept Alliance Request
            {
                if (!playerRank.GetFlag(RankFlags.AllianceControl))
                {
                    pm.SendLocalizedMessage(1063436);                               // You don't have permission to negotiate an alliance.
                }
                else if (otherAlliance != null && otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember(guild))
                {
                    pm.SendLocalizedMessage(1070752);                               // The proposal has been updated.

                    otherAlliance.TurnToMember(m_Other);                            //No need to verify it's in the guild or already a member, the function does this

                    otherAlliance.TurnToMember(guild);
                }
                break;
            }
            }
        }
Exemple #4
0
        public void CreateAlliance_Callback(Mobile from, string text)
        {
            PlayerMobile pm = from as PlayerMobile;

            AllianceInfo alliance      = this.guild.Alliance;
            AllianceInfo otherAlliance = this.m_Other.Alliance;

            if (!IsMember(from, this.guild) || alliance != null)
            {
                return;
            }

            RankDefinition playerRank = pm.GuildRank;

            if (!playerRank.GetFlag(RankFlags.AllianceControl))
            {
                pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance.
            }
            else if (Faction.Find(this.guild.Leader) != Faction.Find(this.m_Other.Leader))
            {
                //Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later.
                pm.SendLocalizedMessage(1070758); // You cannot propose an alliance to a guild with a different faction allegiance.
            }
            else if (otherAlliance != null)
            {
                if (otherAlliance.IsPendingMember(this.m_Other))
                {
                    pm.SendLocalizedMessage(1063416, this.m_Other.Name); // ~1_val~ is currently considering another alliance proposal.
                }
                else
                {
                    pm.SendLocalizedMessage(1063426, this.m_Other.Name); // ~1_val~ already belongs to an alliance.
                }
            }
            else if (this.m_Other.AcceptedWars.Count > 0 || this.m_Other.PendingWars.Count > 0)
            {
                pm.SendLocalizedMessage(1063427, this.m_Other.Name); // ~1_val~ is currently involved in a guild war.
            }
            else if (this.guild.AcceptedWars.Count > 0 || this.guild.PendingWars.Count > 0)
            {
                pm.SendLocalizedMessage(1063427, this.guild.Name); // ~1_val~ is currently involved in a guild war.
            }
            else
            {
                string name = Utility.FixHtml(text.Trim());

                if (!BaseGuildGump.CheckProfanity(name))
                {
                    pm.SendLocalizedMessage(1070886); // That alliance name is not allowed.
                }
                else if (name.Length > Guild.NameLimit)
                {
                    pm.SendLocalizedMessage(1070887, Guild.NameLimit.ToString()); // An alliance name cannot exceed ~1_val~ characters in length.
                }
                else if (AllianceInfo.Alliances.ContainsKey(name.ToLower()))
                {
                    pm.SendLocalizedMessage(1063428); // That alliance name is not available.
                }
                else
                {
                    pm.SendLocalizedMessage(1070750, this.m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~.

                    this.m_Other.GuildMessage(1070780, this.guild.Name); // ~1_val~ has proposed an alliance.

                    new AllianceInfo(this.guild, name, this.m_Other);
                }
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (!IsMember(pm, guild))
            {
                return;
            }

            RankDefinition playerRank = pm.GuildRank;

            switch (info.ButtonID)
            {
            case 1:
            {
                AllianceInfo alliance      = guild.Alliance;
                AllianceInfo otherAlliance = m_Other.Alliance;

                if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
                {
                    pm.SendLocalizedMessage(1063440);                               // You don't have permission to negotiate wars.
                }
                else if (alliance != null && alliance.Leader != guild)
                {
                    pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
                    pm.SendLocalizedMessage(1070707, alliance.Leader.Name);                                 // You need to negotiate via ~1_val~ instead.
                }
                else if (otherAlliance != null && otherAlliance.Leader != m_Other)
                {
                    pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", m_Other.Name, otherAlliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance.
                    pm.SendLocalizedMessage(1070707, otherAlliance.Leader.Name);                                   // You need to negotiate via ~1_val~ instead.
                }
                else
                {
                    WarDeclaration activeWar = guild.FindActiveWar(m_Other);

                    if (activeWar == null)
                    {
                        WarDeclaration war      = guild.FindPendingWar(m_Other);
                        WarDeclaration otherWar = m_Other.FindPendingWar(guild);

                        //Note: OSI differs from what it says on website.  unlimited war = 0 kills/ 0 hrs.  Not > 999.  (sidenote: they both cap at 65535, 7.5 years, but, still.)
                        TextRelay tKills     = info.GetTextEntry(11);
                        TextRelay tWarLength = info.GetTextEntry(10);

                        int      maxKills  = (tKills == null)? 0 : Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(11).Text), 0xFFFF), 0);
                        TimeSpan warLength = TimeSpan.FromHours((tWarLength == null) ? 0 : Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(10).Text), 0xFFFF), 0));

                        if (war != null)
                        {
                            war.MaxKills     = maxKills;
                            war.WarLength    = warLength;
                            war.WarRequester = true;
                        }
                        else
                        {
                            guild.PendingWars.Add(new WarDeclaration(guild, m_Other, maxKills, warLength, true));
                        }

                        if (otherWar != null)
                        {
                            otherWar.MaxKills     = maxKills;
                            otherWar.WarLength    = warLength;
                            otherWar.WarRequester = false;
                        }
                        else
                        {
                            m_Other.PendingWars.Add(new WarDeclaration(m_Other, guild, maxKills, warLength, false));
                        }

                        if (war != null)
                        {
                            pm.SendLocalizedMessage(1070752);                                       // The proposal has been updated.
                            //m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal.
                        }
                        else
                        {
                            m_Other.GuildMessage(1070781, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name));                                         // ~1_val~ has proposed a war.
                        }
                        pm.SendLocalizedMessage(1070751, ((m_Other.Alliance != null) ? m_Other.Alliance.Name : m_Other.Name));                                    // War proposal has been sent to ~1_val~.
                    }
                }
                break;
            }

            default:
            {
                pm.SendGump(new OtherGuildInfo(pm, guild, m_Other));
                break;
            }
            }
        }