Пример #1
0
        private Guildstone FindGuild(string abv)
        {
            // cache the stone
            if (m_Stone != null && m_Stone is Guildstone && m_Stone.Deleted == false)
            {
                return(m_Stone);
            }
            else
            {
                m_Stone = null;
            }

            Guild  guild = null;
            string name  = abv.ToLower();

            foreach (Item n in World.Items.Values)
            {
                if (n is Guildstone && n != null)
                {
                    if (((Guildstone)n).Guild != null)
                    {
                        guild = ((Guildstone)n).Guild;
                    }

                    if (guild.Abbreviation != null && guild.NewPlayerGuild == true && guild.Abbreviation.ToLower() == name)
                    {                       // cache the guildstone
                        m_Stone = (Guildstone)guild.Guildstone;
                        return(m_Stone);
                    }
                }
            }

            return(null);
        }
Пример #2
0
    public void Placement_OnTarget(Mobile from, object targeted)
    {
        if (targeted is not IPoint3D p || Deleted)
        {
            return;
        }

        if (!IsChildOf(from.Backpack))
        {
            from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            return;
        }

        var loc = new Point3D(p);

        var house = BaseHouse.FindHouseAt(loc, from.Map, 16);

        if (house?.IsOwner(from) == true)
        {
            Item addon = new Guildstone(_guild, _guildName, _guildAbbrev);

            addon.MoveToWorld(loc, from.Map);

            house.Add(house.Addons, addon);
            Delete();
        }
        else
        {
            from.SendLocalizedMessage(1042036); // That location is not in your house.
        }
    }
Пример #3
0
        public MoveGuildstoneGump(Mobile from, Guildstone stone) : base(50, 50)
        {
            m_Stone = stone;

            AddPage(0);

            AddBackground(10, 10, 190, 140, 0x242C);

            AddHtml(30, 30, 150, 75, String.Format("<div align=CENTER>{0}</div>", "Are you sure you want to re-deed this guildstone?"), false, false);

            AddButton(40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0);               // Okay
            AddButton(110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0);              // Cancel
        }
Пример #4
0
        public void Disband()
        {
            m_Leader = null;

            List.Remove(Serial);

            foreach (Mobile m in Members)
            {
                m.SendLocalizedMessage(502131); // Your guild has disbanded.

                if (m is PlayerMobile mobile)
                {
                    mobile.GuildRank = RankDefinition.Lowest;
                }

                m.Guild = null;
            }

            Members.Clear();

            for (int i = Allies.Count - 1; i >= 0; --i)
            {
                if (i < Allies.Count)
                {
                    RemoveAlly(Allies[i]);
                }
            }

            for (int i = Enemies.Count - 1; i >= 0; --i)
            {
                if (i < Enemies.Count)
                {
                    RemoveEnemy(Enemies[i]);
                }
            }

            if (!NewGuildSystem)
            {
                Guildstone?.Delete();
            }

            Guildstone = null;

            CheckExpiredWars();

            Alliance = null;
        }
Пример #5
0
			protected override void OnTarget(Mobile from, object o)
			{
				if (!BaseCommand.IsAccessible(from, o))
				{
					from.SendMessage("That is not accessible.");
					return;
				}

				Guild g = null;

				if (o is Guildstone)
				{
					Guildstone stone = o as Guildstone;
					if (stone.Guild == null || stone.Guild.Disbanded)
					{
						from.SendMessage("The guild associated with that Guildstone no longer exists");
						return;
					}
					else
					{
						g = stone.Guild;
					}
				}
				else if (o is Mobile)
				{
					g = ((Mobile)o).Guild as Guild;
				}

				if (g != null)
				{
					from.SendGump(new PropertiesGump(from, g));

					if (NewGuildSystem && from.AccessLevel >= AccessLevel.GameMaster && from is PlayerMobile)
					{
						from.SendGump(new GuildInfoGump((PlayerMobile)from, g));
					}
				}
				else
				{
					from.SendMessage("That is not in a guild!");
				}
			}
Пример #6
0
        private void NewPlayerGuild(Mobile from)
        {               // sanity
            if (from == null || from.Deleted == true || from.NetState == null)
            {
                return;
            }

            Accounting.Account a = from.Account as Accounting.Account;
            if (a != null && a.AccessLevel == AccessLevel.Player)
            {
                // 30 days young
                TimeSpan delta = DateTime.Now - a.Created;
                if (delta.TotalDays <= 30 && Accounting.Accounts.IPLookup(from.NetState.Address) == false)
                {                       // unconditional add
                                        // from.SendGump(new JoinNEWGuildGump(from));
                    Guildstone stone = FindGuild("new");
                    if (stone != null && stone.Guild != null)
                    {                       // log it
                        LogHelper logger = new LogHelper("PlayerAddedToNEWGuild.log", false, true);
                        logger.Log(LogType.Mobile, from);
                        logger.Finish();
                        // do it
                        stone.Guild.AddMember(from);
                        from.DisplayGuildTitle = true;
                        DateTime tx    = DateTime.Now.AddDays(14);
                        string   title = String.Format("{0}/{1}", tx.Month, tx.Day);
                        from.GuildTitle  = title;
                        from.GuildFealty = stone.Guild.Leader != null ? stone.Guild.Leader : from;
                        stone.Guild.GuildMessage(String.Format("{0} has just joined {1}.", from.Name, stone.Guild.Abbreviation == null ? "your guild" : stone.Guild.Abbreviation));
                    }
                    else
                    {
                        from.SendMessage("We're sorry, but the new player guild is temporarily unavailable.");
                    }
                }
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            Container cont = from.BankBox;

            bool backMoney = false;

            switch (info.ButtonID)
            {
            case 0:
            {
                m_Mobile.CloseGump(typeof(JoinGuildGump));

                break;
            }

            case 1:
            {
                int Amount = 25000;

                string name = info.GetTextEntry(1).Text;

                name = name.Trim();

                if (name == "")
                {
                    from.CloseGump(typeof(JoinGuildGump));
                    from.SendLocalizedMessage(1070884);                                       // Guild name cannot be blank.
                    return;
                }

                string abbr = info.GetTextEntry(2).Text;

                abbr = abbr.Trim();

                if (abbr == "")
                {
                    from.CloseGump(typeof(JoinGuildGump));
                    from.SendLocalizedMessage(1070885);                                       // You must provide a guild abbreviation.
                    return;
                }

                if (abbr.Length > 4)
                {
                    from.CloseGump(typeof(JoinGuildGump));
                    from.SendLocalizedMessage(1063037, "4");                                       // An abbreviation cannot exceed ~1_val~ characters in length.
                    return;
                }

                if (cont != null && cont.ConsumeTotal(typeof(Gold), Amount))
                {
                    from.SendLocalizedMessage(1060398, Amount.ToString());                                       // ~1_AMOUNT~ gold has been withdrawn from your bank box.

                    if (!ValidateName(from, name))
                    {
                        from.CloseGump(typeof(JoinGuildGump));
                        backMoney = true;
                    }

                    BaseGuild[] guilds = Guild.Search("");
                    for (int i = 0; i < guilds.Length; i++)
                    {
                        if (abbr.ToLower() == (guilds[i] as BaseGuild).Abbreviation.ToLower())
                        {
                            from.CloseGump(typeof(JoinGuildGump));
                            from.SendLocalizedMessage(501153);                                               // That abbreviation is not available.
                            backMoney = true;
                        }
                    }

                    if (!backMoney)
                    {
                        Guild guild = new Guild(from, name, "none");
                        from.Guild = guild;
                        (from as PlayerMobile).GuildRank = 5;

                        Guildstone gm = new Guildstone(guild);
                        gm.MoveToWorld(new Point3D(0, 0, 0), from.Map);
                        guild.Guildstone = gm;
                        Guild g = from.Guild as Guild;
                        g.Abbreviation = abbr;
                        from.SendLocalizedMessage(1063238);                                           // Your new guild has been founded.
                    }

                    if (backMoney && cont != null)
                    {
                        cont.AddItem(new Gold(Amount));
                        from.SendLocalizedMessage(1060397, Amount.ToString());                                           // ~1_AMOUNT~ gold has been deposited into your bank box.
                    }

                    from.CloseGump(typeof(JoinGuildGump));
                }
                else
                {
                    from.SendLocalizedMessage(1063001, Amount.ToString());                                       // You do not possess the ~1_val~ gold piece fee required to create a guild.
                }

                break;
            }

            case 2:
            {
                if ((from as PlayerMobile).AllowGuildInvites == true)
                {
                    (from as PlayerMobile).AllowGuildInvites = false;
                    from.SendLocalizedMessage(1070698);                                       // You are now ignoring guild invitations.
                    from.CloseGump(typeof(JoinGuildGump));
                }
                else
                {
                    (from as PlayerMobile).AllowGuildInvites = true;
                    from.SendLocalizedMessage(1070699);                                       // You are now accepting guild invitations.
                    from.CloseGump(typeof(JoinGuildGump));
                }

                break;
            }
            }
        }
Пример #8
0
        public override void OnResponse( GameClient state, RelayInfo info )
        {
            Mobile from = state.Mobile;

            Container cont = from.BankBox;

            bool backMoney = false;

            switch ( info.ButtonID )
            {
                case 0:
                    {
                        break;
                    }
                case 200:
                    {
                        int Amount = 25000;

                        string name = info.GetTextEntry( 444 ).Text;

                        name = name.Trim();

                        if ( name == "" )
                        {
                            from.SendLocalizedMessage( 1070884 ); // Guild name cannot be blank.
                            return;
                        }

                        string abbr = info.GetTextEntry( 555 ).Text;

                        abbr = abbr.Trim();

                        if ( abbr == "" )
                        {
                            from.SendLocalizedMessage( 1070885 ); // You must provide a guild abbreviation.
                            return;
                        }

                        if ( abbr.Length > 4 )
                        {
                            from.SendLocalizedMessage( 1063037, "4" ); // An abbreviation cannot exceed ~1_val~ characters in length.
                            return;
                        }

                        foreach ( Faction faction in Faction.Factions )
                        {
                            if ( abbr == faction.Definition.Abbreviation )
                            {
                                from.SendLocalizedMessage( 501153 ); // That abbreviation is not available.
                                return;
                            }
                        }

                        if ( cont != null && cont.ConsumeTotal( typeof( Gold ), Amount ) )
                        {
                            from.SendLocalizedMessage( 1060398, Amount.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.

                            if ( !ValidateName( from, name ) )
                                backMoney = true;

                            BaseGuild[] guilds = Guild.Search( "" );
                            for ( int i = 0; i < guilds.Length; i++ )
                            {
                                if ( abbr.ToLower() == ( guilds[i] as BaseGuild ).Abbreviation.ToLower() )
                                {
                                    from.SendLocalizedMessage( 501153 ); // That abbreviation is not available.
                                    backMoney = true;
                                }
                            }

                            if ( !backMoney )
                            {
                                Guild guild = new Guild( from, name, "none" );
                                from.Guild = guild;
                                ( from as PlayerMobile ).GuildRank = 5;

                                Guildstone gm = new Guildstone( guild );
                                gm.MoveToWorld( new Point3D( 0, 0, 0 ), Map.Trammel );
                                guild.Guildstone = gm;
                                Guild g = from.Guild as Guild;
                                g.Abbreviation = abbr;

                                from.SendLocalizedMessage( 1063238 ); // Your new guild has been founded.
                            }

                            if ( backMoney && cont != null )
                            {
                                cont.AddItem( new Gold( Amount ) );
                                from.SendLocalizedMessage( 1060397, Amount.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage( 1063001, Amount.ToString() ); // You do not possess the ~1_val~ gold piece fee required to create a guild.
                        }

                        break;
                    }
                case 151:
                    {
                        if ( ( from as PlayerMobile ).AcceptGuildInvites == true )
                        {
                            ( from as PlayerMobile ).AcceptGuildInvites = false;
                            from.SendLocalizedMessage( 1070698 ); // You are now ignoring guild invitations.
                        }
                        else
                        {
                            ( from as PlayerMobile ).AcceptGuildInvites = true;
                            from.SendLocalizedMessage( 1070699 ); // You are now accepting guild invitations.
                        }

                        break;
                    }
            }
        }