Пример #1
0
        public override void OnResponse(Mobile from, string text)
        {
            if (GuildGump.BadLeader(m_Mobile, m_Guild))
            {
                return;
            }

            text = text.Trim();

            if (text.Length > 3)
            {
                text = text.Substring(0, 3);
            }

            if (text.Length > 0)
            {
                if (BaseGuild.FindByAbbrev(text) != null)
                {
                    m_Mobile.SendMessage("{0} conflicts with the abbreviation of an existing guild.", text);
                }
                else
                {
                    m_Guild.Abbreviation = text;
                    m_Guild.GuildMessage(1018025, true, text);                       // Your guild abbreviation has changed:
                }
            }

            GuildGump.EnsureClosed(m_Mobile);
            m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
        }
Пример #2
0
        private static void OnLogin(LoginEventArgs e)
        {
            var pm = e.Mobile as PlayerMobile;

            if (pm == null || !pm.IsYoung() || pm.IsYoung() && pm.Guild != null)
            {
                return;
            }

            if (NewGuildPersistence.Instance == null)
            {
                var NGP = new NewGuildPersistence();
            }

            if (NewGuildPersistence.Instance != null && NewGuildPersistence.JoinedIPs != null)
            {
                var loginIPs = ((Account)e.Mobile.Account).LoginIPs.ToArray();
                if (loginIPs.Any(ip => NewGuildPersistence.JoinedIPs.Contains(ip)))
                {
                    return;
                }
            }

            var g = (Guild)BaseGuild.FindByAbbrev("New");

            if (g != null)
            {
                e.Mobile.SendGump(new NewPlayerGuildJoinGump(g, e.Mobile));
            }
        }
Пример #3
0
        public static bool Mobile_AllowHarmful(Mobile from, Mobile target)
        {
            if (from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            #region Dueling
            PlayerMobile pmFrom = from as PlayerMobile;
            PlayerMobile pmTarg = target as PlayerMobile;
            BaseCreature bcFrom = from as BaseCreature;

            if (pmFrom == null && bcFrom != null)
            {
                if (bcFrom.Summoned)
                {
                    pmFrom = bcFrom.SummonMaster as PlayerMobile;
                }
            }

            if (pmFrom != null && pmFrom.Kills >= 5 && !MurderSystemController._RedAllowHarmfulToBluesInTown)
            {
                if (target != null && target.Region != null)
                {
                    GuardedRegion region = (GuardedRegion)target.Region.GetRegion(typeof(GuardedRegion));
                    if (region != null && !region.Disabled)
                    {
                        if (Notoriety.Compute(from, target) == Notoriety.Innocent)
                        {
                            return(false);
                        }
                    }
                }
            }

            if (pmTarg == null && target is BaseCreature)
            {
                BaseCreature bcTarg = (BaseCreature)target;

                if (bcTarg.Summoned)
                {
                    pmTarg = bcTarg.SummonMaster as PlayerMobile;
                }
            }

            if (pmFrom != null && pmTarg != null)
            {
                if (pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)))
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated))
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant)
                {
                    return(false);
                }

                if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started)
                {
                    return(true);
                }
            }

            if ((pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started))
            {
                return(false);
            }

            Engines.ConPVP.SafeZone sz = from.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone;

            if (sz != null /*&& sz.IsDisabled()*/)
            {
                return(false);
            }

            sz = target.Region.GetRegion(typeof(Engines.ConPVP.SafeZone)) as Engines.ConPVP.SafeZone;

            if (sz != null /*&& sz.IsDisabled()*/)
            {
                return(false);
            }
            #endregion

            // Alan mod: custom teams
            if (from.CustomTeam && target.CustomTeam)
            {
                List <XmlTeam> targetTeams = XmlAttach.GetTeams(target);
                List <XmlTeam> fromTeams   = XmlAttach.GetTeams(from);

                if (XmlTeam.SameTeam(fromTeams, targetTeams))
                {
                    return(XmlTeam.AllowTeamHarmful(fromTeams, targetTeams));
                }
                // they are on the enemy team, allow harmful
                return(true);
            }
            // end Alan mod

            if (bcFrom != null)
            {
                if (!bcFrom.Pseu_CanAttackInnocents && Notoriety.Compute(from, target) == Notoriety.Innocent)
                {
                    return(false);
                }
            }
            // end Alan mod

            // ALAN MOD: protect young players from other players in regions where they are given protection
            if (MurderSystemController._YoungProtectionRegionsEnabled)
            {
                if (target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection(from) && !CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target))
                {
                    return(false);
                }
            }
            // END ALAN MOD

            var g = (Guild)BaseGuild.FindByAbbrev("New");//don't allow people in the new guild to attack eachother
            if (g != null && g.IsMember(from) && g.IsMember(target))
            {
                from.CriminalAction(true);
                return(true);
            }

            Map map = from.Map;

            if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0)
            {
                return(true); // In felucca, anything goes
            }
            // check uncontrolled NPC mobs--there's a chance they won't attack if young protection is on
            if (!from.Player && !(bcFrom != null && bcFrom.GetMaster() != null && bcFrom.GetMaster().AccessLevel == AccessLevel.Player))
            {
                if (target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection(from) && !CheckAggressor(from.Aggressors, target) && !CheckAggressed(from.Aggressed, target))
                {
                    return(false);
                }

                return(true); // Uncontrolled NPCs are only restricted by the young system
            }

            Guild fromGuild   = GetGuildFor(from.Guild as Guild, from);
            Guild targetGuild = GetGuildFor(target.Guild as Guild, target);

            if (fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly(targetGuild) || fromGuild.IsEnemy(targetGuild)))
            {
                return(true); // Guild allies or enemies can be harmful
            }
            if (target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster)))
            {
                return(false); // Cannot harm other controlled mobiles
            }
            if (target.Player)
            {
                return(false); // Cannot harm other players
            }
            if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent))
            {
                if (Notoriety.Compute(from, target) == Notoriety.Innocent)
                {
                    return(false); // Cannot harm innocent mobiles
                }
            }

            return(true);
        }
Пример #4
0
        protected override void CompileLayout(SuperGumpLayout layout)
        {
            layout.Add(
                "background",
                () =>
            {
                AddImageTiled(40, 80, 44, 458, 202);
                AddImage(40, 39, 206);
                AddImageTiled(80, 38, 422, 45, 201);
                AddImage(40, 538, 204);
                AddImageTiled(495, 71, 44, 469, 203);
                AddImage(496, 39, 207);
                AddImageTiled(84, 539, 417, 43, 233);
                AddImageTiled(75, 82, 446, 459, 200);
                AddImage(171, 16, 1419);
                AddImage(248, -1, 1417);
                AddImage(257, 8, 5545);
                AddImage(496, 538, 205);

                AddImageTiled(81, 92, 420, 12, 50);
                AddImageTiled(81, 518, 420, 12, 50);
            });

            layout.Add("SideButtons",
                       () =>
            {
                AddButton(0, 87, 224, 223, b =>
                {
                    new CentralGumpUI(User, CentralGump.EnsureProfile(User),
                                      CentralGumpType.News).Send();
                });

                AddButton(0, 154, 222, 221, b =>
                {
                    new CentralGumpUI(User, CentralGump.EnsureProfile(User),
                                      CentralGumpType.Links).Send();
                });


                AddButton(0, 286, 220, 219, b =>
                {
                    new CentralGumpUI(User, CentralGump.EnsureProfile(User),
                                      CentralGumpType.Information).Send();
                });


                AddButton(0, 352, 218, 217, b =>
                {
                    new CentralGumpUI(User, CentralGump.EnsureProfile(User),
                                      CentralGumpType.Commands).Send();
                });


                AddButton(525, 87, 230, 229, b =>
                {
                    new CentralGumpUI(User, CentralGump.EnsureProfile(User),
                                      CentralGumpType.Profile).Send();
                });


                AddButton(525, 154, 232, 231, b =>
                {
                    new CentralGumpUI(User, CentralGump.EnsureProfile(User),
                                      CentralGumpType.Options).Send();
                });


                AddButton(525, 286, 228, 227, b =>
                {
                    new CentralGumpUI(User, CentralGump.EnsureProfile(User),
                                      CentralGumpType.Events).Send();
                });

                AddButton(525, 352, 234, 234, b => { Refresh(true); });
            });

            var acct = User.Account as Account;

            if (acct != null && acct.Young || User.Companion)
            {
                layout.Add("Young",
                           () =>
                {
                    if (acct != null && acct.Young || User.AccessLevel >= AccessLevel.GameMaster)
                    {
                        AddHtml(115, 74, 513, 18,
                                String.Format("<BIG>{0}</BIG>", "Ultima Online: Forever - Young Player Program")
                                .WrapUOHtmlColor(KnownColor.GhostWhite), false, false);

                        AddHtml(95, 112, 155, 17,
                                String.Format("<BIG>{0}</BIG>", "Time Left as Young")
                                .WrapUOHtmlColor(KnownColor.GhostWhite), false, false);

                        AddHtml(95, 135, 165, 17,
                                String.Format("<BIG>{0}</BIG>",
                                              ((int)Math.Ceiling(acct.GetYoungTime().TotalHours) + "/" +
                                               (int)Math.Ceiling(Account.YoungDuration.TotalHours) + " Hours Left"))
                                .WrapUOHtmlColor(KnownColor.GhostWhite), false, false);

                        AddHtml(345, 112, 155, 17,
                                String.Format("<BIG>{0}</BIG>", "Skill Points Left")
                                .WrapUOHtmlColor(KnownColor.GhostWhite), false, false);

                        AddHtml(345, 135, 200, 25,
                                String.Format("<BIG>{0}</BIG>",
                                              600 - User.SkillsTotal / 10 + "/600" + " Skill Points")
                                .WrapUOHtmlColor(KnownColor.GhostWhite), false, false);

                        AddHtml(95, 175, 390, 80,
                                String.Format(
                                    "<BIG>You have {0} hours left as a young player.  You will also reach mature status if you gain {1} more skill points.</BIG>",
                                    (int)Math.Ceiling(acct.GetYoungTime().TotalHours), 600 - (User.SkillsTotal / 10))
                                .WrapUOHtmlColor(KnownColor.GhostWhite), false, false);


                        if (User.Guild == null)
                        {
                            AddButton(305, 260, 4005, 4007, b =>
                            {
                                var g = (Guild)BaseGuild.FindByAbbrev("New");
                                if (g != null && User.Guild == null)
                                {
                                    Refresh(true);
                                    User.SendGump(new NewPlayerGuildJoinGump(g, User));
                                }
                            });

                            AddLabel(340, 260, 2049, "Join the new player guild?");
                        }


                        AddButton(305, 285, 4005, 4007, b =>
                        {
                            if (Profile.LastBritainTeleport <= DateTime.UtcNow && User.PokerGame == null)
                            {
                                User.Map = Map.Felucca;
                                User.MoveToWorld(new Point3D(1438, 1690, 0), Map.Felucca);
                                User.SendMessage(54, "You have been teleported to the West Britain Bank.");
                                Profile.LastBritainTeleport = DateTime.UtcNow + TimeSpan.FromMinutes(5);
                            }
                            else if (User.PokerGame == null)
                            {
                                User.SendMessage(54,
                                                 "You cannot teleport to West Britain Bank for another " +
                                                 (int)
                                                 Math.Ceiling(
                                                     (Profile.LastBritainTeleport - DateTime.UtcNow).TotalMinutes) +
                                                 " minute(s).");
                            }
                            else
                            {
                                User.SendMessage(61, "You cannot use this while playing a poker game.");
                            }
                        });


                        AddLabel(340, 285, 2049, "Travel to Britain?");

                        AddButton(305, 310, 4005, 4007, b =>
                        {
                            if (Profile.LastDungeonTeleport <= DateTime.UtcNow && User.PokerGame == null)
                            {
                                User.Map = Map.Ilshenar;
                                User.MoveToWorld(new Point3D(2182, 18, -32), Map.Ilshenar);
                                User.SendMessage(54, "You have been teleported to the New Player Dungeon.");
                                Profile.LastDungeonTeleport = DateTime.UtcNow + TimeSpan.FromMinutes(5);
                            }
                            else if (User.PokerGame == null)
                            {
                                User.SendMessage(54,
                                                 "You cannot teleport to the New Player Dungeon for another " +
                                                 (int)Math.Ceiling((Profile.LastDungeonTeleport - DateTime.UtcNow).TotalMinutes) +
                                                 " minute(s).");
                            }
                            else
                            {
                                User.SendMessage(61, "You cannot use this while playing a poker game.");
                            }
                        });

                        AddLabel(340, 310, 2049, "Travel to Young Dungeon?");

                        AddButton(305, 335, 4005, 4007);

                        AddLabel(340, 335, 2049, "Page a Companion?");

                        AddButton(305, 360, 4005, 4007, b =>
                        {
                            Refresh(true);
                            if (User.NetState.Gumps.OfType <HelpGump>().Any())
                            {
                                return;
                            }

                            if (!PageQueue.CheckAllowedToPage(User))
                            {
                                return;
                            }

                            if (PageQueue.Contains(User))
                            {
                                User.SendMenu(new ContainedMenu(User));
                            }
                            else
                            {
                                User.SendGump(new Help.HelpGump(User));
                            }
                        });

                        AddLabel(340, 360, 2049, "Page a GM?");

                        AddButton(305, 480, 4005, 4007,
                                  b => new DialogGump(User, this, 0, 0, null, null, 7004, a =>
                        {
                            acct.Young = false;
                            User.SendMessage(54, "You have successfully left the Young Player Program.");
                            CentralGump.Adventurers.Remove(User);
                        }, c => { Refresh(true); })
                        {
                            Title     = "Leave the Young Player Program?",
                            Html      = "Are you sure you wish to leave the Young Player Program?",
                            HtmlColor = DefaultHtmlColor
                        }.Send()
                                  );

                        AddLabel(340, 480, 2049, "Leave the Young Player");

                        AddLabel(340, 495, 2049, "Program?");
                    }

                    if (User.Companion && acct != null && !acct.Young)
                    {
                        AddHtml(109, 74, 513, 18,
                                String.Format("<BIG>{0}</BIG>", "Ultima Online: Forever - Companion Control Panel")
                                .WrapUOHtmlColor(KnownColor.GhostWhite), false, false);

                        AddBackground(61, 107, 454, 125, 3500);

                        AddLabel(86, 114, 2049, "Companion Message of the Day");

                        AddButton(305, 250, 4005, 4007);

                        AddLabel(340, 250, 2049, "Set MotD?");

                        AddButton(305, 280, 4005, 4007);

                        AddLabel(340, 280, 2049, "Answer Companion Pages?");
                    }
                    AddBackground(61, 250, 245, 267, 3500);

                    AddLabel(186, 260, 2049, "Join");

                    AddLabel(85, 260, 2049, "Name");

                    AddLabel(67, 233, 2049, "Adventuring Partners");

                    AddLabel(230, 260, 2049, "Members");

                    if (!CentralGump.Adventurers.Contains(User))
                    {
                        AddButton(305, 420, 4005, 4007, b =>
                        {
                            if (User.Party == null || Party.Get(User).Leader == User)
                            {
                                CentralGump.Adventurers.Add(User);
                                User.SendMessage(54, "You have signed up to start an adventure.");
                                Refresh(true);
                            }
                            else
                            {
                                User.SendMessage(54, "Only the leader of your party may sign up for an adventure.");
                            }
                        });

                        AddLabel(340, 420, 2049, "Join the adventuring");

                        AddLabel(340, 435, 2049, "list?");
                    }
                    else
                    {
                        AddButton(305, 420, 4005, 4007, b =>
                        {
                            CentralGump.Adventurers.Remove(User);
                            User.SendMessage(54, "You have removed yourself from the adventuring list.");
                            Refresh(true);
                        });

                        AddLabel(340, 420, 2049, "Remove yourself from the");

                        AddLabel(340, 435, 2049, "adventuring list?");
                    }

                    if (PageCount - 1 > Page)
                    {
                        AddButton(266, 485, 5601, 5605, NextPage);
                    }

                    if (Page > 0)
                    {
                        AddButton(240, 485, 5603, 5607, PreviousPage);
                    }
                })
                ;
                Dictionary <int, PlayerMobile> range = GetListRange();

                if (range.Count > 0)
                {
                    CompileEntryLayout(layout, range);
                }
            }
            else
            {
                AddHtml(116, 74, 513, 18,
                        String.Format("<BIG>{0}</BIG>", "Ultima Online: Forever - Companion Application")
                        .WrapUOHtmlColor(KnownColor.GhostWhite), false, false);
            }
        }