Ejemplo n.º 1
0
 protected override void OnTick()
 {
     m_From.CriminalAction(false);
     m_From.Kill();
     m_From.Frozen = true; //Needs to reset since it's removed when killed
 }
Ejemplo n.º 2
0
        public static bool CheckReversePickpocket(Mobile from, Item item, Item target)
        {
            if (from == null || from.Deleted ||
                item == null || !(item is BaseBook) || item.Deleted ||
                target == null || target.Deleted)
            {
                return(false);
            }

            if (!(from is PlayerMobile) || !(target is Container))
            {
                return(false);
            }

            Container    c    = ((Container)target);
            PlayerMobile mark = null;

            if (!(c.Parent is PlayerMobile))
            {
                return(false);
            }

            mark = ((PlayerMobile)c.Parent);

            if (mark.Deleted)
            {
                return(false);
            }

            PlayerMobile thief = (PlayerMobile)from;

            //Must be close
            if (thief.GetDistanceToSqrt(mark) > 1)
            {
                return(false);
            }

            //Need 100 steal and snoop to attempt
            if (thief.Skills.Stealing.Base < 100.0 || thief.Skills.Snooping.Base < 100.0)
            {
                return(false);
            }

            //Check perma flags
            if (!thief.PermaFlags.Contains(mark))
            {
                thief.SendMessage("You many only attempt to plant books on marks who you are already criminal to.");
                return(false);
            }

            //Weight..
            if (!c.CheckHold(mark, item, false))
            {
                thief.SendMessage("That person cannot hold the weight!");
                return(false);
            }

            //All we need to do here is the criminal action, since they will already be perma
            if (IsInnocentTo(thief, mark))
            {
                thief.CriminalAction(false);
            }

            //Normal check, 75% chance to plant book successfully
            if (thief.CheckSkill(SkillName.Stealing, 0.75))
            {
                thief.SendMessage("You sucessfully slip them the book.");
                mark.SendMessage(string.Format("You have been slipped {0} !", ((BaseBook)item).Title));
                IPooledEnumerable eable = thief.GetClientsInRange(6);
                if (eable != null)
                {
                    foreach (NetState ns in eable)
                    {
                        if (ns != thief.NetState && ns != mark.NetState)
                        {
                            ns.Mobile.SendMessage("You notice {0} slipping {1} to {2}", thief.Name, ((BaseBook)item).Title, mark.Name);
                        }
                    }
                    eable.Free(); eable = null;
                }
                return(true);
            }
            else
            {
                thief.SendMessage("You fail to slip them the book.");
                IPooledEnumerable eable = thief.GetClientsInRange(6);
                if (eable != null)
                {
                    foreach (NetState ns in eable)
                    {
                        if (ns != thief.NetState && ns != mark.NetState)
                        {
                            ns.Mobile.SendMessage("You notice {0} attempting to slip {1} a book", thief.Name, mark.Name);
                        }
                    }
                    eable.Free(); eable = null;
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                Item   stolen  = null;
                Item   attempt = null;
                object root    = null;
                bool   ok      = false;
                bool   caught  = false;

                Mobile mobRoot = null;

                if (target is Item)
                {
                    attempt = (Item)target;
                    root    = attempt.RootParent;
                    mobRoot = root as Mobile;
                    stolen  = TryStealItem(attempt, root, 3, ref ok, ref caught);
                }
                else if (target is Mobile)
                {
                    Container pack = ((Mobile)target).Backpack;

                    if (pack != null && pack.Items.Count > 0)
                    {
                        from.SendAsciiMessage("You reach into {0}'s backpack and try to take something...", ((Mobile)target).Name);

                        int randomIndex = Utility.Random(pack.Items.Count);
                        root    = target;
                        mobRoot = root as Mobile;
                        attempt = pack.Items[randomIndex] as Item;
                        if (attempt != null)
                        {
                            stolen = TryStealItem(attempt, root, 1, ref ok, ref caught);
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You reach into {0}'s backpack...  But find it's empty.", ((Mobile)target).Name);
                    }
                }
                else
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }

                if (!ok)
                {
                    return;
                }

                if (stolen != null)
                {
                    from.AddToBackpack(stolen);
                    if (mobRoot != null)
                    {
                        Misc.Titles.AlterNotoriety(from, -1, NotoCap.Dishonorable);

                        ArrayList list = m_Table[m_Thief] as ArrayList;
                        if (list == null)
                        {
                            m_Table[m_Thief] = list = new ArrayList(1);
                        }
                        list.Add(mobRoot);
                        new ThiefExpireTimer(mobRoot, m_Thief).Start();
                    }
                }

                if (caught)
                {
                    bool   crime;
                    string fromStr = String.Empty;
                    int    noto    = Notoriety.CanBeAttacked;

                    if (root is Corpse)
                    {
                        crime = ((Corpse)root).IsCriminalAction(m_Thief);
                    }
                    else if (mobRoot != null)
                    {
                        if (m_Saw != null && m_Saw.Count > 0)
                        {
                            crime = Notoriety.Compute(from, mobRoot) == Notoriety.Innocent;
                        }
                        else
                        {
                            crime = false;
                        }

                        fromStr = String.Format(" from {0}", mobRoot.Name);
                    }
                    else
                    {
                        crime = true;
                    }

                    if (crime)
                    {
                        m_Thief.CriminalAction(false);                          // calls guards
                    }
                    else if (noto != Notoriety.Enemy && noto != Notoriety.Ally) // dont go criminal in guild situations
                    {
                        m_Thief.Criminal = true;                                // doesnt call guards
                    }
                    if (m_Saw != null && m_Saw.Count > 0)
                    {
                        string message = null;
                        foreach (Mobile m in m_Saw)
                        {
                            if (m.NetState != null)
                            {
                                if (root is Mobile && m == root)
                                {
                                    StringBuilder sb = new StringBuilder("You notice ");
                                    sb.Append(m_Thief.Name);
                                    sb.Append(" trying to steal ");

                                    if (attempt.Amount > 1)
                                    {
                                        sb.Append("some ");
                                    }
                                    else
                                    {
                                        sb.Append("a ");
                                    }

                                    if (attempt is BaseItem)
                                    {
                                        ((BaseItem)attempt).AppendClickName(sb);
                                    }
                                    else if (attempt.Name != null && attempt.Name != "")
                                    {
                                        sb.Append(attempt.Name);
                                    }
                                    else
                                    {
                                        sb.Append(attempt.ItemData.Name);
                                    }

                                    sb.Append(" from you!");
                                    m.SendAsciiMessage(sb.ToString());
                                }
                                else
                                {
                                    if (message == null)
                                    {
                                        if (stolen != null)
                                        {
                                            attempt = stolen;
                                        }
                                        if (attempt != null)
                                        {
                                            StringBuilder sb = new StringBuilder("You notice ");
                                            sb.Append(m_Thief.Name);
                                            sb.Append(" trying to steal ");

                                            if (attempt.Amount > 1)
                                            {
                                                sb.Append("some ");
                                            }
                                            else
                                            {
                                                sb.Append("a ");
                                            }

                                            if (attempt is BaseItem)
                                            {
                                                ((BaseItem)attempt).AppendClickName(sb);
                                            }
                                            else if (attempt.Name != null && attempt.Name != "")
                                            {
                                                sb.Append(attempt.Name);
                                            }
                                            else
                                            {
                                                sb.Append(attempt.ItemData.Name);
                                            }

                                            sb.Append(fromStr);
                                            sb.Append('!');
                                            message = sb.ToString();
                                        }
                                        else
                                        {
                                            message = String.Format("You notice {0} trying to something steal something{1}!", m_Thief.Name, fromStr);
                                        }
                                    }

                                    m.SendAsciiMessage(message);
                                }
                            }
                            else if (m is BaseCreature)
                            {
                                if (m.Body.IsHuman)
                                {
                                    if (!(m is BaseGuard) && !(m is PlayerVendor))
                                    {
                                        m.Say(Utility.RandomList(1007037, 501603, 1013037, 1013038, 1013039, 1013041, 1013042, 1013043, 1013052));
                                    }
                                    if (crime)
                                    {
                                        GuardedRegion reg = m.Region as GuardedRegion;
                                        if (reg != null && !reg.IsDisabled())
                                        {
                                            reg.CallGuards(m.Location);
                                        }
                                    }
                                }

                                if (root == m && Utility.RandomBool())
                                {
                                    BaseCreature bc = (BaseCreature)m;
                                    if (!bc.Controled && (bc.AlwaysMurderer || (bc.AlwaysAttackable && !bc.IsHarmfulCriminal(m_Thief))))
                                    {
                                        bc.Attack(m_Thief);
                                    }
                                }
                            }
                        }                        // foreach m_Saw
                    }
                }
            }
Ejemplo n.º 4
0
        public virtual bool CanMessage(PlayerMobile user, string text, bool message = true)
        {
            if (!Available)
            {
                if (message)
                {
                    InternalMessage(user, "The channel '{0}' is currently unavailable.", Name);
                }

                return(false);
            }

            if (!IsUser(user) && user.AccessLevel < AccessLevel.Counselor)
            {
                if (message)
                {
                    InternalMessage(user, "You are not in the channel '{0}'", Name);
                }

                return(false);
            }

            if (user.AccessLevel < Access)
            {
                if (message)
                {
                    InternalMessage(user, "You do not have sufficient access to speak in the channel '{0}'", Name);
                }

                return(false);
            }

            if (IsUser(user) && user.AccessLevel < AccessLevel.Counselor && Users[user] > DateTime.Now)
            {
                if (message)
                {
                    InternalMessage(user, "Spam detected, message blocked.");
                }

                return(false);
            }

            if (!NameVerification.Validate(
                    text,
                    0,
                    Int32.MaxValue,
                    true,
                    true,
                    false,
                    Int32.MaxValue,
                    ProfanityProtection.Exceptions,
                    ProfanityProtection.Disallowed,
                    ProfanityProtection.StartDisallowed))
            {
                switch (ProfanityAction)
                {
                case ProfanityAction.None:
                    return(true);

                case ProfanityAction.Criminal:
                    user.Criminal = true;
                    return(true);

                case ProfanityAction.CriminalAction:
                    user.CriminalAction(true);
                    return(true);

                case ProfanityAction.Disallow:
                    return(false);

                case ProfanityAction.Disconnect:
                    Kick(user, false, message);
                    return(false);

                case ProfanityAction.Other:
                    return(OnProfanityDetected(user, text, message));
                }
            }

            return(true);
        }