IsWar() public méthode

public IsWar ( Guild g ) : bool
g Guild
Résultat bool
        public override void OnResponse(NetState state, RelayInfo info)
        {
            int cat = info.ButtonID;

            switch (cat)
            {
            case 0:
                return;

            case 1:
            {
                GuildGump.EnsureClosed(m_Mobile);
                m_Mobile.SendGump(new ViewGuildRosterGump(m_Mobile, m_ThierGuild));
                return;
            }

            case 2:
            {
                if (m_Guild == null)
                {
                    m_Mobile.SendMessage("You are not in a guild");
                }
                else if (m_ThierGuild == null)
                {
                    m_Mobile.SendMessage("You have selected an invalid guild");
                }
                else if (m_Guild == m_ThierGuild)
                {
                    m_Mobile.SendMessage("You cannot declare war with your own guild");
                }
                else if (m_Guild.Leader != m_Mobile)
                {
                    m_Mobile.SendMessage("You are not the leader of this guild");
                }
                else if ((m_Guild.WarInvitations.Contains(m_ThierGuild) && m_ThierGuild.WarDeclarations.Contains(m_Guild)) || m_Guild.IsWar(m_ThierGuild))
                {
                    m_Mobile.SendMessage("You are already at war with that guild.");
                }
                else
                {
                    if (!m_Guild.WarDeclarations.Contains(m_ThierGuild))
                    {
                        m_Guild.WarDeclarations.Add(m_ThierGuild);
                        m_Guild.GuildMessage(1018019, true, "{0} ({1})", m_ThierGuild.Name, m_ThierGuild.Abbreviation);                                   // Guild Message: Your guild has sent an invitation for war:
                    }

                    if (!m_ThierGuild.WarInvitations.Contains(m_Guild))
                    {
                        m_ThierGuild.WarInvitations.Add(m_Guild);
                        m_ThierGuild.GuildMessage(1018021, true, "{0} ({1})", m_Guild.Name, m_Guild.Abbreviation);                                   // Guild Message: Your guild has received an invitation to war:
                    }
                }
                break;
            }
            }
            m_Mobile.SendGump(new GuildWarInfoGump(m_Mobile, m_Guild));
        }
        public DiplomacyMiscGump( Mobile leader, Guild target )
            : base(10, 40)
        {
            m_Mobile = leader;
            t_Guild = target;
            m_Guild = m_Mobile.Guild as Guild;

            /*0*/
            Intern( "Unknown" );
            /*1*/
            Intern( "" );
            /*2*/
            Intern( "" );
            /*3*/
            Intern( "0/0" );
            /*4*/
            Intern( "0/0" );
            /*5*/
            Intern( "00:00" );
            /*6*/
            Intern( target.Name );
            /*7*/
            Intern( "<basefont color=#black>" + t_Guild.AllianceName + "</basefont>" );
            /*8*/
            Intern( target.Abbreviation );
            /*9*/
            Intern( "<basefont color=#black>0/0</basefont>" );
            /*10*/
            Intern( "<basefont color=#black>00:00</basefont>" );
            /*11*/
            Intern( "<basefont color=#black>0/0</basefont>" );

            AddPage( 0 );

            AddBackground( 0, 0, 520, 335, 0x242C );

            AddHtmlLocalized( 20, 15, 480, 26, 1062975, false, false ); // <div align=center><i>Guild Relationship</i></div>
            AddImageTiled( 20, 40, 480, 2, 0x2711 );

            AddHtmlLocalized( 20, 50, 120, 26, 1062954, true, false ); // <i>Guild Name</i>
            AddHtmlIntern( 150, 53, 360, 26, 6, false, false );

            AddHtmlLocalized( 20, 80, 120, 26, 1063025, true, false ); // <i>Alliance</i>
            AddHtmlIntern( 150, 83, 360, 26, 7, false, false );

            AddHtmlLocalized( 20, 110, 120, 26, 1063139, true, false ); // <i>Abbreviation</i>
            AddHtmlIntern( 150, 113, 120, 26, 8, false, false );

            AddHtmlLocalized( 280, 110, 120, 26, 1062966, true, false ); // <i>Your Kills</i>
            AddHtmlIntern( 410, 113, 120, 26, 9, false, false );

            AddHtmlLocalized( 20, 140, 120, 26, 1062968, true, false ); // <i>Time Remaining</i>
            AddHtmlIntern( 150, 143, 120, 26, 10, false, false );

            AddHtmlLocalized( 280, 140, 120, 26, 1062967, true, false ); // <i>Their Kills</i>
            AddHtmlIntern( 410, 143, 120, 26, 11, false, false );

            AddImageTiled( 20, 172, 480, 2, 0x2711 );

            AddBackground( 275, 290, 225, 26, 0x2486 );
            AddButton( 280, 295, 0x845, 0x846, 0, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 305, 293, 185, 26, 3000091, false, false ); // Cancel

            AddBackground( 20, 290, 225, 26, 0x2486 );
            AddButton( 25, 295, 0x845, 0x846, 400, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 50, 293, 185, 26, 1062989, false, false ); // Declare War!

            AddBackground( 20, 260, 225, 26, 0x2486 );
            AddButton( 25, 265, 0x845, 0x846, 305, GumpButtonType.Reply, 0 ); // Request Alliance
            AddHtmlLocalized( 50, 263, 185, 26, 1062990, false, false );

            if ( m_Guild.IsWar( t_Guild ) )
                AddHtmlLocalized( 20, 180, 480, 30, 1062965, true, false ); // war
            else if ( m_Guild.IsAlly( t_Guild ) )
                AddHtmlLocalized( 20, 180, 480, 30, 1062970, true, false ); // allied
            else
                AddHtmlLocalized( 20, 180, 480, 30, 1062973, true, false ); // peace

            AddImageTiled( 20, 245, 480, 2, 0x2711 );
        }
Exemple #3
0
        public DiplomacyGump( Mobile from, Guild guild, ArrayList list, int Sort_Type, int page, string search )
            : base(10, 10)
        {
            m_Mobile = from;
            m_Guild = guild;
            m_Page = page;
            m_Search = search;
            m_SortType = Sort_Type;

            if ( Sort_Type >= 10 )
            {
                updown = true;
                Sort_Type = Sort_Type - 10;
            }
            else
            {
                updown = false;
            }

            AddPage( 0 );

            AddBackground( 0, 0, 600, 440, 0x24AE );

            AddBackground( 66, 40, 150, 26, 0x2486 );
            AddButton( 71, 45, 0x845, 0x846, 100, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 96, 43, 110, 26, 1063014, false, false );

            AddBackground( 236, 40, 150, 26, 0x2486 );
            AddButton( 241, 45, 0x845, 0x846, 110, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 266, 43, 110, 26, 1062974, false, false );

            AddBackground( 401, 40, 150, 26, 0x2486 );
            AddButton( 406, 45, 0x845, 0x846, 120, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 431, 43, 110, 26, 1062978, 0xF, false, false );

            AddButton( 95, 80, 0x15E1, 0x15E5, 800, ( ( page + 1 ) * 8 ) >= list.Count ? GumpButtonType.Page : GumpButtonType.Reply, 0 ); // Next Page
            AddButton( 65, 80, 0x15E3, 0x15E7, 801, page == 0 ? GumpButtonType.Page : GumpButtonType.Reply, 0 ); // Previous Page

            AddBackground( 130, 75, 385, 30, 0xBB8 );
            AddTextEntry( 135, 80, 375, 30, 0x481, 3535, search );
            AddButton( 520, 75, 0x867, 0x868, 750, GumpButtonType.Reply, 0 );

            AddImageTiled( 65, 110, 290, 26, 0xA40 );
            AddImageTiled( 67, 112, 286, 22, 0xBBC );
            AddHtmlLocalized( 70, 113, 280, 20, 1062954, false, false );

            if ( Sort_Type == 0 ) // Sort by Name
            {
                if ( updown )
                    AddButton( 339, 117, 0x983, 0x984, 401, GumpButtonType.Reply, 0 );
                else
                    AddButton( 339, 117, 0x985, 0x986, 400, GumpButtonType.Reply, 0 );
            }
            else
            {
                AddButton( 339, 117, 0x2716, 0x2716, 400, GumpButtonType.Reply, 0 );
            }

            AddImageTiled( 357, 110, 60, 26, 0xA40 );
            AddImageTiled( 359, 112, 56, 22, 0xBBC );
            AddHtmlLocalized( 362, 113, 50, 20, 1062957, false, false );

            if ( Sort_Type == 1 ) // Sort by Abbreviation
            {
                if ( updown )
                    AddButton( 401, 117, 0x983, 0x984, 403, GumpButtonType.Reply, 0 );
                else
                    AddButton( 401, 117, 0x985, 0x986, 402, GumpButtonType.Reply, 0 );
            }
            else
            {
                AddButton( 401, 117, 0x2716, 0x2716, 402, GumpButtonType.Reply, 0 );
            }

            AddImageTiled( 419, 110, 130, 26, 0xA40 );
            AddImageTiled( 421, 112, 126, 22, 0xBBC );
            AddHtmlLocalized( 424, 113, 120, 20, 1062958, false, false );

            if ( Sort_Type == 2 ) // Sort by Status
            {
                if ( updown )
                    AddButton( 534, 117, 0x983, 0x984, 405, GumpButtonType.Reply, 0 );
                else
                    AddButton( 534, 117, 0x985, 0x986, 404, GumpButtonType.Reply, 0 );
            }
            else
            {
                AddButton( 534, 117, 0x2716, 0x2716, 404, GumpButtonType.Reply, 0 );
            }

            m_List = new ArrayList( list.Count );
            m_List = list;

            switch ( Sort_Type )
            {
                case 0:
                    {
                        m_List.Sort( new ListNameSorter( updown ) );
                        break;
                    }
                case 1:
                    {
                        m_List.Sort( new ListAbbrSorter( updown ) );
                        break;
                    }
                case 2:
                    {
                        m_SortWarList = new ArrayList();
                        m_SortAllyList = new ArrayList();

                        int j = 0;

                        while ( j < m_List.Count )
                        {
                            if ( ( (Guild) m_List[j] ).IsWar( m_Guild ) )
                            {
                                m_SortWarList.Add( m_List[j] );
                                m_List.Remove( m_List[j] );
                            }
                            else
                            {
                                j++;
                            }
                        }

                        j = 0;

                        while ( j < m_List.Count )
                        {
                            if ( ( (Guild) m_List[j] ).IsAlly( m_Guild ) )
                            {
                                m_SortAllyList.Add( m_List[j] );
                                m_List.Remove( m_List[j] );
                            }
                            else
                            {
                                j++;
                            }
                        }

                        m_SortAllyList.Sort( new ListNameSorter( updown ) );
                        m_SortWarList.Sort( new ListNameSorter( updown ) );
                        m_List.Sort( new ListNameSorter( updown ) );

                        for ( j = 0; j < m_SortAllyList.Count; j++ )
                            m_SortWarList.Add( m_SortAllyList[j] );

                        for ( j = 0; j < m_List.Count; j++ )
                            m_SortWarList.Add( m_List[j] );

                        m_List = m_SortWarList;
                        break;
                    }
                case 3:
                    {
                        m_List.Sort( new ListRelationshipSorter( updown ) );
                        break;
                    }
                case 4:
                    {
                        m_List.Sort( new ListAwaitingSorter( updown ) );
                        break;
                    }
            }

            for ( int i = ( m_Page * 8 ), n = 0; i < list.Count && i < 8 + ( m_Page * 8 ); ++i, ++n )
            {
                Guild g = (Guild) list[i] as Guild;

                if ( m_Guild.WarInvitations.Contains( g ) || m_Guild.AllyInvitations.Contains( g ) || g.AllyDeclarations.Contains( m_Guild ) || g.WarDeclarations.Contains( m_Guild ) || g.WarInvitations.Contains( m_Guild ) || g.AllyInvitations.Contains( m_Guild ) || m_Guild.AllyDeclarations.Contains( g ) || m_Guild.WarDeclarations.Contains( g ) )
                    AddButton( 36, 143 + ( n * 28 ), 0x8AF, 0x8AF, i + 1000, GumpButtonType.Reply, 0 );
                else
                    AddButton( 40, 143 + ( n * 28 ), 0x4B9, 0x4BA, i + 1000, GumpButtonType.Reply, 0 );

                AddImageTiled( 65, 138 + ( n * 28 ), 290, 26, 0xA40 );
                AddImageTiled( 67, 140 + ( n * 28 ), 286, 22, 0xBBC );

                if ( g.Name == m_Guild.Name )
                    AddHtml( 70, 141 + ( n * 28 ), 280, 20, "<basefont color=#006600>" + g.Name + "</basefont>", false, false );
                else
                    AddHtml( 70, 141 + ( n * 28 ), 280, 20, g.Name, false, false );

                AddImageTiled( 357, 138 + ( n * 28 ), 60, 26, 0xA40 );
                AddImageTiled( 359, 140 + ( n * 28 ), 56, 22, 0xBBC );

                AddHtml( 362, 141 + ( n * 28 ), 50, 20, g.Abbreviation, false, false );

                AddImageTiled( 419, 138 + ( n * 28 ), 130, 26, 0xA40 );
                AddImageTiled( 421, 140 + ( n * 28 ), 126, 22, 0xBBC );

                if ( g == m_Guild )
                {
                    if ( g.Allies.Count > 0 )
                    {
                        if ( g.AllianceLeader )
                            AddHtmlLocalized( 424, 141 + ( n * 28 ), 120, 20, 1063237, false, false ); // Alliance Leader
                        else
                            AddHtmlLocalized( 424, 141 + ( n * 28 ), 120, 20, 1062964, false, false ); // Ally
                    }
                    else
                    {
                        AddHtmlLocalized( 424, 141 + ( n * 28 ), 120, 20, 3000085, false, false ); // Peace
                    }
                }
                if ( m_Guild.IsWar( g ) )
                {
                    AddHtmlLocalized( 424, 141 + ( n * 28 ), 120, 20, 3000086, false, false ); // War
                }
                else if ( m_Guild.IsAlly( g ) )
                {
                    if ( g.AllianceLeader )
                        AddHtmlLocalized( 424, 141 + ( n * 28 ), 120, 20, 1063237, false, false ); // Alliance Leader
                    else
                        AddHtmlLocalized( 424, 141 + ( n * 28 ), 120, 20, 1062964, false, false ); // Ally
                }
                else if ( g != m_Guild )
                {
                    AddHtmlLocalized( 424, 141 + ( n * 28 ), 120, 20, 3000085, false, false ); // Peace
                }

                if ( i == m_List.Count - 1 && m_Guild.Allies.Count + 1 >= m_List.Count )
                    AddHtml( 66, 204 + ( ( n - 1 ) * 28 ), 300, 26, "<basefont color=#000066>" + g.AllianceName + "</basefont>", false, false );
                else
                    AddKRLabel( 0, 0, 0, 0, -1, false, false );
            }

            if ( Sort_Type == 3 )
                AddHtmlLocalized( 66, 377, 280, 26, 1063138, 0xF, false, false );
            else if ( Sort_Type == 4 )
                AddHtmlLocalized( 66, 377, 280, 26, 1063137, 0xF, false, false );
            else
                AddHtmlLocalized( 66, 377, 280, 26, 1063136, 0xF, false, false );

            AddBackground( 350, 372, 200, 26, 0x2486 );
            AddButton( 355, 377, 0x845, 0x846, 975, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 380, 375, 160, 26, 1063083, false, false ); // Advanced Search
            AddKRHtmlLocalized( 0, 0, 0, 0, -2, false, false );
        }