Exemple #1
0
        private void Power_OnTarget(Mobile fromMobile, object obj, object state)
        {
            Player from = state as Player;

            Item item = obj as Item;

            if (item == null || item.Deleted)
            {
                return;
            }

            if (item is IEthicsItem)
            {
                EthicsItem ethicItem = EthicsItem.Find(item);

                if (item.Parent != fromMobile)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You may only imbue items you are wearing.");
                }
                else if (ethicItem != null && ethicItem.Ethic != Ethic.Find(fromMobile))
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "The magic surrounding this item repels your attempts to imbue.");
                }
                else if (item is IFactionItem && ((IFactionItem)item).FactionItemState != null)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "The magic surrounding this item is too chaotic to imbue.");
                }
                else if (item.LootType != LootType.Regular || item.BlessedFor != null)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "The magic surrounding this item is too strong to imbue.");
                }
                //else if ( fromMobile.Map == Map.Felucca && !fromMobile.InRange( new Point3D( 2492, 3930, 5 ), 6 ) )
                //	fromMobile.LocalOverheadMessage( MessageType.Regular, 0x3B2, false, "You require the power of a heroic shrine to imbue this item." );
                else if (!fromMobile.Backpack.ConsumeTotal(typeof(Gold), GoldRequired))
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, String.Format("You must sacrifice {0} gold piece{1} to imbue this item.", GoldRequired, (GoldRequired != 1) ? "s" : String.Empty));
                }
                else if (CheckInvoke(from))
                {
                    if (ethicItem != null)
                    {
                        ethicItem.StartExpiration();
                    }
                    else
                    {
                        EthicsItem.Imbue(item, Ethic.Hero, true, Ethic.Hero.Definition.PrimaryHue);
                    }

                    fromMobile.FixedEffect(0x375A, 10, 20);
                    fromMobile.PlaySound(0x209);
                    fromMobile.SendMessage("The item is now blessed against evil for 24 real world hours.");

                    FinishInvoke(from);
                }
            }
            else
            {
                fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "That cannot be imbued!");
            }
        }
Exemple #2
0
        public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
        {
            if (!Ethic.CheckTrade(from, to, newOwner, this))
            {
                return(false);
            }

            return(base.AllowSecureTrade(from, to, newOwner, accepted));
        }
 public override bool OnEquip(Mobile from)
 {
     if (from is PlayerMobile && Player.Find(from) != null && Player.Find(from).Ethic != Ethic.Hero)
     {
         from.SendMessage(54, "Only those following the path of good may use this spellbook!");
         Ethic.DestoryItem(from, this);
         return(false);
     }
     return(true);
 }
Exemple #4
0
        public override bool IsEligible(Mobile mob)
        {
            if (mob.SkillsTotal >= 5000 && Ethic.HasEligibleSkill(mob))
            {
                Faction fac = Faction.Find(mob);

                return(mob.AccessLevel == AccessLevel.Player && !(fac is TrueBritannians || fac is CouncilOfMages));
            }

            return(false);
        }
Exemple #5
0
        public override bool IsEligible(Mobile mob)
        {
            if (mob.SkillsTotal >= 5000 && Ethic.HasEligibleSkill(mob))
            {
                Faction fac = Faction.Find(mob);

                return(mob.AccessLevel == AccessLevel.Player && !(fac is Minax || fac is Shadowlords));
            }

            return(false);
        }
Exemple #6
0
 public override void OnDoubleClick(Mobile from)
 {
     if (Ethic.Find(from) != Ethic.Evil)
     {
         from.SendMessage("You may not ride this steed.");
     }
     else
     {
         base.OnDoubleClick(from);
     }
 }
 public override void OnDoubleClick(Mobile from)
 {
     base.OnDoubleClick(from);
     if (from is PlayerMobile && Player.Find(from) != null && Player.Find(from).Ethic == Ethic.Hero)
     {
         new EthicSpellbookUI(from as PlayerMobile, null, new HeroEthic()).Send();
     }
     else
     {
         from.SendMessage(54, "Only those following the path of good may use this spellbook!");
         Ethic.DestoryItem(from, this);
     }
 }
Exemple #8
0
        public override bool CanEquip(Mobile from)
        {
            if (!Ethic.CheckEquip(from, this))
            {
                return(false);
            }
            else if (!from.CanBeginAction(typeof(BaseWeapon)))
            {
                return(false);
            }

            return(base.CanEquip(from));
        }
Exemple #9
0
        public override DeathMoveResult OnInventoryDeath(Mobile parent)
        {
            DeathMoveResult result = base.OnParentDeath(parent);

            if (result == DeathMoveResult.MoveToCorpse && m_EthicState != null && Ethic.IsEthicsDeath(parent))
            {
                return(DeathMoveResult.MoveToBackpack);
            }
            else
            {
                return(result);
            }
        }
Exemple #10
0
        public override DeathMoveResult OnInventoryDeath(Mobile parent)
        {
            DeathMoveResult result      = base.OnParentDeath(parent);
            Ethic           parentState = Ethic.Find(parent);

            if (parentState != null && result == DeathMoveResult.MoveToCorpse && m_EthicState != null && parentState == m_EthicState.Ethic)
            {
                return(DeathMoveResult.MoveToBackpack);
            }
            else
            {
                return(result);
            }
        }
Exemple #11
0
        public EthicSpellbookUI(
            PlayerMobile user, Gump parent = null, Ethic ethic = null)
            : base(user, parent)
        {
            Ethic = ethic;

            PlayerState = Player.Find(user);

            ForceRecompile = true;

            CanMove = true;

            Sorted = true;

            EntriesPerPage = 2;
        }
Exemple #12
0
        private void Power_OnTarget(Mobile fromMobile, object obj, object state)
        {
            Player from = state as Player;

            Item item = obj as Item;

            if (item == null || item.Deleted)
            {
                return;
            }

            if (item is BaseArmor || item is BaseWeapon)
            {
                EthicsItem ethicItem = EthicsItem.Find(item);

                if (item.Parent != fromMobile)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You may only imbue items you are wearing.");
                }
                else if (ethicItem == null)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "This item has not been imbued with an unholy curse.");
                }
                else if (ethicItem.Ethic != Ethic.Find(fromMobile))
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "The magic surrounding this item repels your attempts to imbue.");
                }
                else if (!fromMobile.Backpack.ConsumeTotal(typeof(Emerald), EmeraldsRequired))
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, String.Format("You must sacrifice {0} emerald{1} to imbue this item.", EmeraldsRequired, (EmeraldsRequired != 1) ? "s" : String.Empty));
                }
                else if (CheckInvoke(from))
                {
                    ethicItem.MakeRunic();

                    fromMobile.FixedEffect(0x375A, 10, 20, 1156, 0);
                    fromMobile.PlaySound(0x209);

                    FinishInvoke(from);
                }
            }
            else
            {
                fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500352);                   // This is neither weapon nor armor.
            }
        }
        public override void OnDoubleClick(Mobile @from)
        {
            Ethic hero = Ethic.Find(from);

            if (!(hero is HeroEthic) && from.AccessLevel == AccessLevel.Player)
            {
                from.SendMessage(54, "You must follow the path of the hero to use this mount!");
                return;
            }
            if (BoundMobile != from as PlayerMobile && from.AccessLevel == AccessLevel.Player)
            {
                from.SendMessage(54, "You cannot use this item as it is not bound to you!");
                return;
            }

            base.OnDoubleClick(@from);
        }
Exemple #14
0
        public override bool CanEquip(Mobile from)
        {
            if (!Ethic.CheckEquip(from, this))
            {
                return(false);
            }
            else if (!from.CanBeginAction(typeof(BaseWeapon)))
            {
                return(false);
            }
            else if (_Owner != null && _Owner != from)
            {
                from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                return(false);
            }
            else if (IsVvVItem && !Engines.VvV.ViceVsVirtueSystem.IsVvV(from))
            {
                from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
                return(false);
            }

            return(base.CanEquip(from));
        }
Exemple #15
0
        public void InvitePlayer_Callback(Mobile from, object targeted, object state)
        {
            PlayerMobile pm   = from as PlayerMobile;
            PlayerMobile targ = targeted as PlayerMobile;

            Guild g = state as Guild;

            PlayerState guildState  = PlayerState.Find(g.Leader);
            PlayerState targetState = PlayerState.Find(targ);

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

            Ethic guildEthic  = Ethic.Find(g.Leader);
            Ethic targetEthic = Ethic.Find(targ);

            if (pm == null || !IsMember(pm, guild) || !pm.GuildRank.GetFlag(RankFlags.CanInvitePlayer))
            {
                pm.SendLocalizedMessage(503301);                   // You don't have permission to do that.
            }
            else if (targ == null)
            {
                pm.SendLocalizedMessage(1063334);                   // That isn't a valid player.
            }
            else if (!targ.AcceptGuildInvites)
            {
                pm.SendLocalizedMessage(1063049, targ.Name);                   // ~1_val~ is not accepting guild invitations.
            }
            else if (g.IsMember(targ))
            {
                pm.SendLocalizedMessage(1063050, targ.Name);                   // ~1_val~ is already a member of your guild!
            }
            else if (targ.Guild != null)
            {
                pm.SendLocalizedMessage(1063051, targ.Name);                                       // ~1_val~ is already a member of a guild.
            }
            else if (targ.HasGump(typeof(BaseGuildGump)) || targ.HasGump(typeof(CreateGuildGump))) //TODO: Check message if CreateGuildGump Open
            {
                pm.SendLocalizedMessage(1063052, targ.Name);                                       // ~1_val~ is currently considering another guild invitation.
            }
            #region Factions
            else if (targ.Young && guildFaction != null)
            {
                pm.SendLocalizedMessage(1070766);                   // You cannot invite a young player to your faction-aligned guild.
            }
            else if (guildFaction != targetFaction)
            {
                if (guildFaction == null)
                {
                    pm.SendLocalizedMessage(1013027);                       // That player cannot join a non-faction guild.
                }
                else if (targetFaction == null)
                {
                    pm.SendLocalizedMessage(1013026);                       // That player must be in a faction before joining this guild.
                }
                else
                {
                    pm.SendLocalizedMessage(1013028);                       // That person has a different faction affiliation.
                }
            }
            else if (guildEthic != targetEthic)
            {
                if (guildEthic == null)
                {
                    pm.SendMessage("That player cannot join a non-ethic guild.");
                }
                else if (targetEthic == null)
                {
                    pm.SendMessage("That player must be {0} {1} before joining this guild.", guildEthic.Definition.ArticleAn ? "an" : "a", guildEthic.Definition.Title);
                }
                else
                {
                    pm.SendMessage("That player is {0} {1}!  You cannot recruit {2}!", targetEthic.Definition.ArticleAn ? "an" : "a", targetEthic.Definition.Title, targ.Female ? "her" : "him");
                }
            }
            else if (targetState != null && targetState.IsLeaving)
            {
                // OSI does this quite strangely, so we'll just do it this way
                pm.SendMessage("That person is quitting their faction and so you may not recruit them.");
            }
            #endregion
            else
            {
                pm.SendLocalizedMessage(1063053, targ.Name);                   // You invite ~1_val~ to join your guild.
                targ.SendGump(new GuildInvitationRequest(targ, guild, pm));
            }
        }
Exemple #16
0
        public override void PopulateGump()
        {
            bool isLeader = IsLeader(player, guild);

            base.PopulateGump();

            AddHtmlLocalized(96, 43, 110, 26, 1063014, 0xF, false, false);               // My Guild

            AddImageTiled(65, 80, 160, 26, 0xA40);
            AddImageTiled(67, 82, 156, 22, 0xBBC);
            AddHtmlLocalized(70, 83, 150, 20, 1062954, 0x0, false, false);               // <i>Guild Name</i>
            AddHtml(233, 84, 320, 26, guild.Name, false, false);

            AddImageTiled(65, 114, 160, 26, 0xA40);
            AddImageTiled(67, 116, 156, 22, 0xBBC);
            AddHtmlLocalized(70, 117, 150, 20, 1063025, 0x0, false, false);               // <i>Alliance</i>

            if (guild.Alliance != null && guild.Alliance.IsMember(guild))
            {
                AddHtml(233, 118, 320, 26, guild.Alliance.Name, false, false);
                AddButton(40, 120, 0x4B9, 0x4BA, 6, GumpButtonType.Reply, 0);                   //Alliance Roster
            }

            if (Faction.Enabled || Ethic.Enabled)
            {
                AddImageTiled(65, 148, 160, 26, 0xA40);
                AddImageTiled(67, 150, 156, 22, 0xBBC);
                AddHtmlLocalized(70, 151, 150, 20, 1063084, 0x0, false, false);                   // <i>Guild Faction</i>

                if (Faction.Enabled)
                {
                    Faction f = Faction.Find(guild.Leader);
                    if (f != null)
                    {
                        AddHtml(233, 152, 320, 26, f.ToString(), false, false);
                    }
                }
                else
                {
                    Ethic e = Ethic.Find(guild.Leader);
                    if (e != null)
                    {
                        AddHtml(233, 152, 320, 26, e.Definition.Title, false, false);
                    }
                }
            }

            if (isLeader)
            {
                bool neutral = true;
                bool order   = false;
                bool chaos   = false;

                if (guild.Type != GuildType.Regular)
                {
                    neutral = false;
                    if (guild.Type == GuildType.Chaos)
                    {
                        chaos = true;
                    }
                    else
                    {
                        order = true;
                    }
                }

                //Begin Order/Chaos
                AddRadio(440, 75, 9727, 9730, neutral, 1); //neutral
                AddLabel(480, 80, 2622, @"Neutral");
                AddRadio(440, 105, 9727, 9730, order, 2);  //order
                AddLabel(480, 110, 90, @"Order");
                AddRadio(440, 135, 9727, 9730, chaos, 3);  //chaos
                AddLabel(480, 140, 32, @"Chaos");

                AddButton(465, 175, 247, 248, 8, GumpButtonType.Reply, 0); //accept
            }

            AddImageTiled(65, 196, 480, 4, 0x238D);


            string s = guild.Charter;

            if (String.IsNullOrEmpty(s))
            {
                s = "The guild leader has not yet set the guild charter.";
            }

            AddHtml(65, 216, 480, 80, s, true, true);
            if (isLeader)
            {
                AddButton(40, 251, 0x4B9, 0x4BA, 4, GumpButtonType.Reply, 0);                   //Charter Edit button
            }
            s = guild.Website;
            if (string.IsNullOrEmpty(s))
            {
                s = "Guild website not yet set.";
            }
            AddHtml(65, 306, 480, 30, s, true, false);
            if (isLeader)
            {
                AddButton(40, 313, 0x4B9, 0x4BA, 5, GumpButtonType.Reply, 0);                   //Website Edit button
            }
            AddCheck(65, 370, 0xD2, 0xD3, player.DisplayGuildTitle, 0);
            AddHtmlLocalized(95, 370, 150, 26, 1063085, 0x0, false, false);               // Show Guild Title
            AddBackground(450, 370, 100, 26, 0x2486);

            AddButton(455, 375, 0x845, 0x846, 7, GumpButtonType.Reply, 0);
            AddHtmlLocalized(480, 373, 60, 26, 3006115, (m_IsResigning) ? 0x5000 : 0, false, false);               // Resign
        }
Exemple #17
0
        private void Power_OnTarget(Mobile fromMobile, object obj, object state)
        {
            var from = state as Player;

            var item = obj as Item;

            if (item == null || item.Deleted)
            {
                return;
            }

            if (item is IEthicsItem)
            {
                EthicsItem ethicItem = EthicsItem.Find(item);

                if (item.Parent != fromMobile)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "You may only imbue items you are wearing.");
                }
                else if (ethicItem != null)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 32, false,
                                                    "This item has already been imbued with an evil essence.");
                }
                else if (ethicItem != null && ethicItem.Ethic != Ethic.Find(fromMobile))
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "The magic surrounding this item repels your attempts to imbue.");
                }
                else if (item is IFactionItem && ((IFactionItem)item).FactionItemState != null)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "The magic surrounding this item is too chaotic to imbue.");
                }
                else if (item.LootType == LootType.Cursed)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "The magic surrounding this item resists your attempts to imbue.");
                }
                else if (item.LootType == LootType.Blessed && !(item is Spellbook) || item.BlessedFor != null)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "The magic surrounding this item is too strong to imbue.");
                }
                else if (!fromMobile.Backpack.ConsumeTotal(typeof(Gold), GoldRequired))
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    String.Format("You must sacrifice {0} gold piece{1} to imbue this item.", GoldRequired,
                                                                  (GoldRequired != 1) ? "s" : String.Empty));
                }
                else if (CheckInvoke(from))
                {
                    /*if ( ethicItem != null )
                     *                          ethicItem.StartExpiration();
                     *                  else*/
                    EthicsItem.Imbue(item, Ethic.Evil, Ethic.Evil.Definition.PrimaryHue);

                    fromMobile.FixedEffect(0x375A, 10, 20);
                    fromMobile.PlaySound(0x209);

                    fromMobile.LocalOverheadMessage(MessageType.Regular, 32, false,
                                                    "You have imbued this item with an evil essence.");

                    FinishInvoke(from);
                }
            }
            else
            {
                fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "That cannot be imbued!");
            }
        }
        private void Power_OnTarget(Mobile fromMobile, object obj, object state)
        {
            var from = state as Player;

            var item = obj as Item;

            if (item == null || item.Deleted)
            {
                return;
            }

            if (item is BaseArmor || item is BaseWeapon)
            {
                EthicsItem ethicItem = EthicsItem.Find(item);

                if (item.Parent != fromMobile)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "You may only imbue items you are wearing.");
                }
                else if (ethicItem == null)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "This item has not been imbued with a holy blessing.");
                }
                else if (ethicItem.Ethic != Ethic.Find(fromMobile))
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "The magic surrounding this item repels your attempts to imbue.");
                }
                else if (item is BaseWeapon && ((BaseWeapon)item).DamageLevel != WeaponDamageLevel.Regular ||
                         item is BaseArmor && ((BaseArmor)item).ProtectionLevel != ArmorProtectionLevel.Regular)
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    "You cannot imbue magic items!");
                }
                else if (!fromMobile.Backpack.ConsumeTotal(typeof(Sapphire), SapphiresRequired))
                {
                    fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
                                                    String.Format("You must sacrifice {0} sapphire{1} to imbue this item.", SapphiresRequired,
                                                                  (SapphiresRequired != 1) ? "s" : String.Empty));
                }
                else if (CheckInvoke(from))
                {
                    if (!ethicItem.IsRunic)
                    {
                        ethicItem.StartExpiration();
                        ethicItem.MakeRunic();

                        fromMobile.FixedEffect(0x375A, 10, 20, 1153, 0);
                        fromMobile.PlaySound(0x209);

                        FinishInvoke(from);
                        fromMobile.LocalOverheadMessage(MessageType.Regular, 90, false,
                                                        "You have sanctified this item.");
                    }
                    else
                    {
                        fromMobile.LocalOverheadMessage(MessageType.Regular, 90, false,
                                                        "You have already sanctified this item.");
                    }
                }
            }
            else
            {
                fromMobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500352);
                // This is neither weapon nor armor.
            }
        }
Exemple #19
0
        public PlayerDetailGump(PlayerMobile from, PlayerMobile mobile)
        {
            _from   = from;
            _mobile = mobile;

            Width = 320;

            int n = Notoriety.Compute(from, mobile);

            int notoColor = _notorietyColors[n];

            AddBorderedText(20, 18, Width - 40, 20, Center(mobile.Name ?? "Unknown"), notoColor, BlackColor32);

            AddSeperator(30, 40, Width - 60);

            const int LabelOffset = 20;
            const int LabelWidth  = 55;

            const int ValueOffset = 25 + LabelWidth;
            int       ValueWidth  = Width - (20 + ValueOffset);

            int y = 44;

            PlayerMobile pm = mobile as PlayerMobile;

            Guild guild = mobile.Guild as Guild;

            if (guild != null)
            {
                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Guild:"), LabelColor32, BlackColor32);

                AddBorderedText(ValueOffset, y, ValueWidth, 20, guild.Name ?? "Unknown", WhiteColor32, BlackColor32);
                y += 20;
            }

            if (mobile.PublicMyRunUO && mobile.Kills >= 5)
            {
                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Kills:"), LabelColor32, BlackColor32);
                AddBorderedText(ValueOffset, y, ValueWidth, 20, mobile.Kills.ToString("N0"), WhiteColor32, BlackColor32);

                y += 20;
            }

            Account acct = mobile.Account as Account;

            if (acct != null)
            {
                TimeSpan age = DateTime.UtcNow - acct.Created;

                int ageInDays = ( int )age.TotalDays;

                int ageInYears  = ((ageInDays + 162) / 365);
                int ageInMonths = ((ageInDays + 15) / 30);
                int ageInWeeks  = ((ageInDays + 3) / 7);

                string ageString;

                if (ageInYears > 0)
                {
                    ageString = String.Format("{0:N0} year{1}", ageInYears, ageInYears == 1?"":"s");
                }
                else if (ageInMonths > 1)
                {
                    ageString = String.Format("{0:N0} month{1}", ageInMonths, ageInMonths == 1?"":"s");
                }
                else if (ageInWeeks > 1)
                {
                    ageString = String.Format("{0:N0} week{1}", ageInWeeks, ageInWeeks == 1?"":"s");
                }
                else
                {
                    ageString = String.Format("Newbie", ageInDays, ageInDays == 1?"":"s");
                }



                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Age:"), LabelColor32, BlackColor32);
                AddBorderedText(ValueOffset, y, ValueWidth, 20, ageString, WhiteColor32, BlackColor32);

                y += 20;
            }

            PlayerState ps = PlayerState.Find(mobile);

            if (ps != null)
            {
                Faction fac = ps.Faction;

                //AddItem( Width - 51, 7, 5535, (fac.Definition.HueSecondary ^ 0x0000) - 1 );
                AddItem(7, 7, 5534, (fac.Definition.HuePrimary ^ 0x0000) - 1);

                y += 8;

                AddBorderedText(LabelOffset, y, LabelWidth + ValueWidth, 20, fac.Definition.FriendlyName, WhiteColor32, BlackColor32);

                y += 21;
                AddSeperator(30, y, Width - 60);
                y += 3;

                string rank = String.Format(
                    "Level {0} {1}",
                    ps.Rank.Rank,
                    ps.Rank.Title.String
                    );

                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Rank:"), LabelColor32, BlackColor32);
                AddBorderedText(ValueOffset, y, ValueWidth, 20, rank, WhiteColor32, BlackColor32);
                y += 20;

                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Points:"), LabelColor32, BlackColor32);
                AddBorderedText(ValueOffset, y, ValueWidth, 20, String.Format("{0:N0}", ps.KillPoints), WhiteColor32, BlackColor32);
                y += 20;
            }

            Ladder instance = Ladder.Instance;

            if (instance != null)
            {
                LadderEntry entry = instance.Find(mobile);

                if (entry != null && (entry.Wins + entry.Losses) > 0)
                {
                    y += 8;

                    AddBorderedText(LabelOffset, y, LabelWidth + ValueWidth, 20, "Duelist", WhiteColor32, BlackColor32);

                    y += 21;
                    AddSeperator(30, y, Width - 60);
                    y += 3;

                    string rank = LadderGump.Rank(entry.Index + 1);

                    AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Rank:"), LabelColor32, BlackColor32);
                    AddBorderedText(ValueOffset, y, ValueWidth, 20, rank, WhiteColor32, BlackColor32);
                    y += 20;

                    AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Level:"), LabelColor32, BlackColor32);
                    AddBorderedText(ValueOffset, y, ValueWidth, 20, Ladder.GetLevel(entry.Experience).ToString("N0"), WhiteColor32, BlackColor32);
                    y += 20;

                    AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Matches:"), LabelColor32, BlackColor32);
                    AddBorderedText(ValueOffset, y, ValueWidth, 20, String.Format("{0:N0}", (entry.Wins + entry.Losses)), WhiteColor32, BlackColor32);
                    y += 20;
                }
            }

            Height = y + 12;

            Ethic ethic = Ethic.Find(mobile);

            if (ethic == Ethic.Hero)
            {
                AddItem(Width - 36, Height - 26, 7188);
            }
            else if (ethic == Ethic.Evil)
            {
                AddItem(Width - 35, Height - 36, 6232);
            }
        }
Exemple #20
0
        public override void BeginInvoke(Player from)
        {
            Ethic opposition = Ethic.Hero;

            int enemyCount = 0;

            int maxRange = 18 + from.Power;

            Player primary = null;

            foreach (Player pl in opposition.Players)
            {
                Mobile mob = pl.Mobile;

                if (mob == null || mob.Map != from.Mobile.Map || !mob.Alive)
                {
                    continue;
                }

                if (!mob.InRange(from.Mobile, Math.Max(18, maxRange - pl.Power)))
                {
                    continue;
                }

                if (primary == null || pl.Power > primary.Power)
                {
                    primary = pl;
                }

                ++enemyCount;
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("You sense ");
            sb.Append(enemyCount == 0 ? "no" : enemyCount.ToString());
            sb.Append(enemyCount == 1 ? " enemy" : " enemies");

            if (primary != null)
            {
                sb.Append(", and a strong presense");

                switch (from.Mobile.GetDirectionTo(primary.Mobile))
                {
                case Direction.West:
                    sb.Append(" to the west.");
                    break;

                case Direction.East:
                    sb.Append(" to the east.");
                    break;

                case Direction.North:
                    sb.Append(" to the north.");
                    break;

                case Direction.South:
                    sb.Append(" to the south.");
                    break;

                case Direction.Up:
                    sb.Append(" to the north-west.");
                    break;

                case Direction.Down:
                    sb.Append(" to the south-east.");
                    break;

                case Direction.Left:
                    sb.Append(" to the south-west.");
                    break;

                case Direction.Right:
                    sb.Append(" to the north-east.");
                    break;
                }
            }
            else
            {
                sb.Append('.');
            }

            from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x59, false, sb.ToString());

            FinishInvoke(from);
        }
Exemple #21
0
        public override void BeginInvoke(Player from)
        {
            // spam trap
            if (DateTime.Now - lastUsed < TimeSpan.FromSeconds(.7))
            {
                return;
            }

            lastUsed = DateTime.Now;

            Ethic opposition = Ethic.Evil;

            int enemyCount = 0;

            int maxRange = 18 + from.Power;

            Player primary = null;

            foreach (Player pl in opposition.Players)
            {
                Mobile mob = pl.Mobile;

                if (mob == null || mob.Map != from.Mobile.Map || !mob.Alive)
                {
                    continue;
                }

                if (!mob.InRange(from.Mobile, Math.Max(18, maxRange - pl.Power)))
                {
                    continue;
                }

                if (primary == null || pl.Power > primary.Power)
                {
                    primary = pl;
                }

                ++enemyCount;
            }

            // different message for old ethics system when there are no enemies
            // we are not sure of the message when there are enemies, so we will go with the later ethics messages
            if (Core.OldEthics)
            {
                if (enemyCount == 0)
                {
                    from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x59, false, "There are no enemies afoot.");
                    FinishInvoke(from);
                    return;
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("You sense ");
            sb.Append(enemyCount == 0 ? "no" : enemyCount.ToString());
            sb.Append(enemyCount == 1 ? " enemy" : " enemies");

            if (primary != null)
            {
                sb.Append(", and a strong presense");

                switch (from.Mobile.GetDirectionTo(primary.Mobile))
                {
                case Direction.West:
                    sb.Append(" to the west.");
                    break;

                case Direction.East:
                    sb.Append(" to the east.");
                    break;

                case Direction.North:
                    sb.Append(" to the north.");
                    break;

                case Direction.South:
                    sb.Append(" to the south.");
                    break;

                case Direction.Up:
                    sb.Append(" to the north-west.");
                    break;

                case Direction.Down:
                    sb.Append(" to the south-east.");
                    break;

                case Direction.Left:
                    sb.Append(" to the south-west.");
                    break;

                case Direction.Right:
                    sb.Append(" to the north-east.");
                    break;
                }
            }
            else
            {
                sb.Append('.');
            }

            from.Mobile.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x59, false, sb.ToString());

            FinishInvoke(from);
        }
Exemple #22
0
            protected override void OnTick()
            {
                if (!m_Owner.Deleted)
                {
                    m_Owner.Criminal = false;
                    m_Owner.Kills    = 0;
                    m_Owner.Stam     = m_Owner.StamMax;

                    Mobile target = m_Owner.Focus;

                    if (m_Owner.Weapon is Fists)
                    {
                        m_Owner.Kill();
                    }
                    else if (target != null)
                    {
                        if (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful(target))
                        {
                            m_Owner.Focus = null;
                        }
                        else
                        {                        // <instakill>
                            if (m_Owner.Combatant != target)
                            {
                                m_Owner.Combatant = target;
                            }
                            TeleportTo(target);
                            target.BoltEffect(0);

                            if (target is BaseCreature)
                            {
                                ((BaseCreature)target).NoKillAwards = true;
                            }

                            target.Damage(target.HitsMax, m_Owner);
                            target.Kill();                             // just in case, maybe Damage is overridden on some shard

                            if (target.Corpse != null && !target.Player)
                            {
                                target.Corpse.Delete();
                            }

                            if (target is PlayerMobile)
                            {
                                if (Faction.Find(target) != null)
                                {
                                    Faction.ApplySkillLoss(target);
                                }

                                if (Ethics.Player.Find(target) != null)
                                {
                                    Ethic.ApplySkillLoss(target);
                                }
                            }

                            m_Owner.Focus = null;
                        }                        // </instakill>

                        /*else if ( !m_Owner.InRange( target, 20 ) )
                         *      m_Owner.Focus = null;
                         * else if ( !m_Owner.InRange( target, 10 ) || !m_Owner.InLOS( target ) )
                         *      TeleportTo( target );
                         * else if ( !m_Owner.InRange( target, 1 ) )
                         * {
                         *      if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) )
                         *              TeleportTo( target );
                         * }
                         * else if ( !m_Owner.CanSee( target ) )
                         * {
                         *      if ( !m_Owner.UseSkill( SkillName.DetectHidden ) && Utility.Random( 50 ) == 0 )
                         *              m_Owner.Say( "Reveal!" );
                         * }*/
                    }

                    Stop();
                }
            }
Exemple #23
0
        public virtual bool Scissor(Mobile from, Scissors scissors)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(502437);                   // Items you wish to cut must be in your backpack.
                return(false);
            }

            if (Ethic.IsImbued(this))
            {
                from.SendLocalizedMessage(502440);                   // Scissors can not be used on that to produce anything.
                return(false);
            }

            CraftSystem system = DefTailoring.CraftSystem;

            CraftItem item = system.CraftItems.SearchFor(GetType());

            if (item != null && item.Resources.Count == 1 && item.Resources.GetAt(0).Amount >= 2)
            {
                try
                {
                    Type resourceType = null;

                    CraftResourceInfo info = CraftResources.GetInfo(m_Resource);

                    if (info != null && info.ResourceTypes.Length > 0)
                    {
                        resourceType = info.ResourceTypes[0];
                    }

                    if (resourceType == null)
                    {
                        resourceType = item.Resources.GetAt(0).ItemType;
                    }

                    // Debug code
                    //from.SendMessage("item: {0}", Layer);

                    Item res = null;

                    if (Layer == Layer.Shoes)
                    {
                        res = new Leather();
                    }
                    else
                    {
                        res = new Bandage();
                    }

                    ScissorHelper(from, res, (item.Resources.GetAt(0).Amount / 2));

                    res.LootType = LootType.Regular;

                    return(true);
                }
                catch
                {
                }
            }

            from.SendLocalizedMessage(502440);               // Scissors can not be used on that to produce anything.
            return(false);
        }
Exemple #24
0
        public override bool CanEquip(Mobile from)
        {
            if (!Ethic.CheckEquip(from, this))
            {
                return(false);
            }

            if (Amount > 1)
            {
                from.SendAsciiMessage("You can only equip one clothing at a time");
                return(false);
            }

            if (DonationItem)
            {
                if (Owner == null)
                {
                    Owner = from;
                }
                else if (Owner != from && (LootType == LootType.Blessed || LootType == LootType.Newbied))
                {
                    from.SendAsciiMessage("This is not your clothing");
                    return(false);
                }

                /*
                 * if (Owner != from)
                 * {
                 *  from.SendAsciiMessage("This is not your clothing");
                 *  return false;
                 * }*/
            }

            /*
             *          if( from.AccessLevel < AccessLevel.GameMaster )
             *          {
             *                  if( RequiredRace != null && from.Race != RequiredRace )
             *                  {
             *                          if( RequiredRace == Race.Elf )
             *                                  from.SendLocalizedMessage( 1072203 ); // Only Elves may use this.
             *                          else
             *                                  from.SendMessage( "Only {0} may use this.", RequiredRace.PluralName );
             *
             *                          return false;
             *                  }
             *                  else if( !AllowMaleWearer && !from.Female )
             *                  {
             *                          if( AllowFemaleWearer )
             *                                  from.SendLocalizedMessage( 1010388 ); // Only females can wear this.
             *                          else
             *                                  from.SendMessage( "You may not wear this." );
             *
             *                          return false;
             *                  }
             *                  else if( !AllowFemaleWearer && from.Female )
             *                  {
             *                          if( AllowMaleWearer )
             *                                  from.SendLocalizedMessage( 1063343 ); // Only males can wear this.
             *                          else
             *                                  from.SendMessage( "You may not wear this." );
             *
             *                          return false;
             *                  }
             *                  else
             *                  {
             *                          int strBonus = ComputeStatBonus( StatType.Str );
             *                          int strReq = ComputeStatReq( StatType.Str );
             *
             *                          if( from.Str < strReq || (from.Str + strBonus) < 1 )
             *                          {
             *                                  from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that.
             *                                  return false;
             *                          }
             *                  }
             *          }
             */

            return(true);       // return base.CanEquip(from);
        }
Exemple #25
0
            private SmeltResult Resmelt(Mobile from, Item item, CraftResource resource)
            {
                try
                {
                    if (Ethic.IsImbued(item))
                    {
                        return(SmeltResult.Invalid);
                    }

                    if (CraftResources.GetType(resource) != CraftResourceType.Metal)
                    {
                        return(SmeltResult.Invalid);
                    }

                    CraftResourceInfo info = CraftResources.GetInfo(resource);

                    if (info == null || info.ResourceTypes.Length == 0)
                    {
                        return(SmeltResult.Invalid);
                    }

                    CraftItem craftItem = m_CraftSystem.CraftItems.SearchFor(item.GetType());

                    if (craftItem == null || craftItem.Resources.Count == 0)
                    {
                        return(SmeltResult.Invalid);
                    }

                    CraftRes craftResource = craftItem.Resources.GetAt(0);

                    if (craftResource.Amount < 2)
                    {
                        return(SmeltResult.Invalid); // Not enough metal to resmelt
                    }
                    var difficulty = resource switch
                    {
                        CraftResource.DullCopper => 65.0,
                        CraftResource.ShadowIron => 70.0,
                        CraftResource.Copper => 75.0,
                        CraftResource.Bronze => 80.0,
                        CraftResource.Gold => 85.0,
                        CraftResource.Agapite => 90.0,
                        CraftResource.Verite => 95.0,
                        CraftResource.Valorite => 99.0,
                        _ => 0.0
                    };

                    if (difficulty > from.Skills.Mining.Value)
                    {
                        return(SmeltResult.NoSkill);
                    }

                    Type resourceType = info.ResourceTypes[0];
                    Item ingot        = (Item)ActivatorUtil.CreateInstance(resourceType);

                    if (item is DragonBardingDeed || item is BaseArmor armor && armor.PlayerConstructed ||
                        item is BaseWeapon weapon && weapon.PlayerConstructed ||
                        item is BaseClothing clothing && clothing.PlayerConstructed)
                    {
                        ingot.Amount = craftResource.Amount / 2;
                    }
                    else
                    {
                        ingot.Amount = 1;
                    }

                    item.Delete();
                    from.AddToBackpack(ingot);

                    from.PlaySound(0x2A);
                    from.PlaySound(0x240);
                    return(SmeltResult.Success);
                }
Exemple #26
0
        public static void EventSink_PlayerDeath(PlayerDeathEventArgs e)
        {
            Mobile m = e.Mobile;

            List <Mobile> killers = new List <Mobile>();
            List <Mobile> toGive  = new List <Mobile>();

            foreach (AggressorInfo ai in m.Aggressors)
            {
                if (Ethic.Find(ai.Attacker) == null || Ethic.Find(m) == null)
                {                 //Allow people of the same ethic to flag each other as murderers?  Factioners can?
                    if (ai.Attacker.Player && ai.CanReportMurder && !ai.Reported && (!Core.SE || !((PlayerMobile)m).RecentlyReported.Contains(ai.Attacker)))
                    {
                        killers.Add(ai.Attacker);
                        ai.Reported        = true;
                        ai.CanReportMurder = false;
                    }

                    if (ai.Attacker.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Attacker))
                    {
                        toGive.Add(ai.Attacker);
                    }
                }
            }

            foreach (AggressorInfo ai in m.Aggressed)
            {
                if (ai.Defender.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Defender))
                {
                    toGive.Add(ai.Defender);
                }
            }

            foreach (Mobile g in toGive)
            {
                int n = Notoriety.Compute(g, m);

                int  theirKarma = m.Karma, ourKarma = g.Karma;
                bool innocent = (n == Notoriety.Innocent);
                bool criminal = (n == Notoriety.Criminal || n == Notoriety.Murderer);

                int fameAward  = m.Fame / 200;
                int karmaAward = 0;

                if (innocent)
                {
                    karmaAward = (ourKarma > -2500 ? -850 : -110 - (m.Karma / 100));
                }
                else if (criminal)
                {
                    karmaAward = 50;
                }

                Titles.AwardFame(g, fameAward, false);
                Titles.AwardKarma(g, karmaAward, true);
            }

            if (m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild)
            {
                return;
            }

            if (killers.Count > 0)
            {
                new GumpTimer(m, killers, m.Location, m.Map).Start();
            }
        }