Exemple #1
0
 public static void InvokeGuildGumpRequest(GuildGumpRequestArgs e)
 {
     if (GuildGumpRequest != null)
     {
         GuildGumpRequest(e);
     }
 }
Exemple #2
0
        private static void EventSink_GuildGumpRequest( GuildGumpRequestArgs e )
        {
            Mobile beholder = e.Mobile;

            beholder.CloseGump( typeof( AdvancedSearchGump ) );
            beholder.CloseGump( typeof( DiplomacyGump ) );
            beholder.CloseGump( typeof( DiplomacyMiscGump ) );
            beholder.CloseGump( typeof( JoinGuildGump ) );
            beholder.CloseGump( typeof( InviteGump ) );
            beholder.CloseGump( typeof( RosterGump ) );
            beholder.CloseGump( typeof( RosterMiscGump ) );
            beholder.CloseGump( typeof( MyGuildGump ) );

            Guild guild = beholder.Guild as Guild;

            if ( beholder.Map == beholder.Map && beholder.InRange( beholder, 12 ) )
            {
                if ( guild == null || guild.Disbanded )
                {
                    beholder.SendGump( new JoinGuildGump( beholder, guild ) );
                }
                else if ( guild.Accepted.Contains( beholder ) )
                {
                    #region Factions
                    PlayerState guildState = PlayerState.Find( guild.Leader );
                    PlayerState targetState = PlayerState.Find( beholder );

                    Faction guildFaction = ( guildState == null ? null : guildState.Faction );
                    Faction targetFaction = ( targetState == null ? null : targetState.Faction );

                    if ( guildFaction != targetFaction || ( targetState != null && targetState.IsLeaving ) )
                        return;

                    if ( guildState != null && targetState != null )
                        targetState.Leaving = guildState.Leaving;
                    #endregion

                    guild.Accepted.Remove( beholder );
                    guild.AddMember( beholder );

                    ( beholder as PlayerMobile ).GuildRank = 1;

                    beholder.SendGump( new MyGuildGump( beholder, guild ) );
                }
                else
                {
                    beholder.SendGump( new MyGuildGump( beholder, guild ) );
                }
            }
        }