Ejemplo n.º 1
0
        public void AddAlly(Guild g)
        {
            if (!Allies.Contains(g))
            {
                Allies.Add(g);

                g.AddAlly(this);
            }
        }
Ejemplo n.º 2
0
        public override void OnResponse(GameClient sender, RelayInfo info)
        {
            int m_Rank = (m_Mobile as PlayerMobile).GuildRank;

            if (m_Guild.BadMember(m_Mobile))
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 0:                     // Cancel
            {
                m_Mobile.CloseGump(typeof(AcceptAllianceGump));

                BaseGuild[] guilds = Guild.Search("");

                m_Mobile.SendGump(new DiplomacyGump(m_Mobile, m_Guild, new ArrayList(guilds), 2));

                break;
            }

            case 304:                     // Deny Alliance
            {
                if (m_Rank != 5)
                {
                    m_Mobile.SendLocalizedMessage(1063436);                                       // You don't have permission to negotiate an alliance.

                    return;
                }

                if (t_Guild != null)
                {
                    if (t_Guild.Allies.Count <= 0)
                    {
                        t_Guild.AllianceName = "";
                    }

                    m_Guild.AllyInvitations.Remove(t_Guild);

                    t_Guild.AllyDeclarations.Remove(m_Guild);

                    m_Mobile.SendLocalizedMessage(1070752);                                       // The proposal nas been updated.

                    m_Mobile.CloseGump(typeof(AcceptAllianceGump));
                }

                break;
            }

            case 303:                     // Accept Alliance
            {
                if (m_Rank != 5)
                {
                    m_Mobile.SendLocalizedMessage(1063436);                                       // You don't have permission to negotiate an alliance.

                    return;
                }

                if (t_Guild != null)
                {
                    if (t_Guild.Allies.Count <= 0)
                    {
                        t_Guild.AllianceLeader = true;
                    }

                    m_Guild.AllyInvitations.Remove(t_Guild);

                    t_Guild.AllyDeclarations.Remove(m_Guild);

                    Guild a_Guild;

                    if (t_Guild.Allies.Count > 0)
                    {
                        for (int i = 0; i < t_Guild.Allies.Count; i++)
                        {
                            a_Guild = t_Guild.Allies[i] as Guild;

                            m_Guild.AddAlly(a_Guild);

                            a_Guild.AddAlly(m_Guild);
                        }
                    }

                    m_Guild.AddAlly(t_Guild);

                    t_Guild.AddAlly(m_Guild);

                    m_Guild.AllianceName = t_Guild.AllianceName;

                    m_Mobile.SendLocalizedMessage(1070760, m_Guild.AllianceName);                 // Your Guild has joined the ~1_ALLIANCENAME~ Alliance.

                    m_Mobile.SendLocalizedMessage(1070761, t_Guild.Name);                         // A new Guild has joined your Alliance: ~1_GUILDNAME~

                    t_Guild.Leader.SendLocalizedMessage(1070760, t_Guild.AllianceName);           // Your Guild has joined the ~1_ALLIANCENAME~ Alliance.

                    t_Guild.Leader.SendLocalizedMessage(1070761, m_Guild.Name);                   //   A new Guild has joined your Alliance: ~1_GUILDNAME~

                    m_Mobile.SendLocalizedMessage(1070752);                                       // The proposal nas been updated.
                }

                m_Mobile.CloseGump(typeof(AcceptAllianceGump));

                break;
            }

            case 310:                     // Show Alliance Roster
            {
                if (m_Guild.Allies.Count > 0)
                {
                    ArrayList guilds = new ArrayList(m_Guild.Allies);

                    guilds.Add(m_Guild);

                    m_Mobile.SendGump(new DiplomacyGump(m_Mobile, m_Guild, new ArrayList(guilds), 2));
                }

                m_Mobile.CloseGump(typeof(AcceptAllianceGump));

                break;
            }
            }
        }
Ejemplo n.º 3
0
        public void AddAlly( Guild g )
        {
            if ( !m_Allies.Contains( g ) )
            {
                m_Allies.Add( g );

                g.AddAlly( this );
            }
        }