Exemplo n.º 1
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                StealableArtifactsSpawner.StealableInstance si = null;
                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                if (toSteal is DungeonChest)
                {
                    DungeonChest dBox = (DungeonChest)toSteal;

                    if (m_Thief.Blessed)
                    {
                        m_Thief.SendMessage("You cannot steal while in this state.");
                    }
                    else if (dBox.ItemID == 0x3582 || dBox.ItemID == 0x3583 || dBox.ItemID == 0x35AD || dBox.ItemID == 0x3868 || (dBox.ItemID >= 0x4B5A && dBox.ItemID <= 0x4BAB) || (dBox.ItemID >= 0xECA && dBox.ItemID <= 0xED2))
                    {
                        m_Thief.SendMessage("It is best to leave the dead be.");
                    }
                    else if (dBox.ItemID == 0x3564 || dBox.ItemID == 0x3565)
                    {
                        m_Thief.SendMessage("You have not use for this broken golem thing.");
                    }
                    else
                    {
                        if (m_Thief.CheckSkill(SkillName.Stealing, 0, 125))
                        {
                            m_Thief.SendMessage("You dump out the entire contents while stealing the item.");
                            StolenChest sBox   = new StolenChest();
                            int         dValue = 0;

                            dValue               = (dBox.ContainerLevel + 1) * 50;
                            sBox.ContainerID     = dBox.ContainerID;
                            sBox.ContainerGump   = dBox.ContainerGump;
                            sBox.ContainerHue    = dBox.ContainerHue;
                            sBox.ContainerFlip   = dBox.ContainerFlip;
                            sBox.ContainerWeight = dBox.ContainerWeight;
                            sBox.ContainerName   = dBox.ContainerName;

                            sBox.ContainerValue = dValue;

                            Item iBox = (Item)sBox;

                            iBox.ItemID = sBox.ContainerID;
                            iBox.Hue    = sBox.ContainerHue;
                            iBox.Weight = sBox.ContainerWeight;
                            iBox.Name   = sBox.ContainerName;

                            Bag oBox = (Bag)iBox;

                            oBox.GumpID = sBox.ContainerGump;

                            m_Thief.AddToBackpack(oBox);

                            Titles.AwardFame(m_Thief, dValue, true);

                            LoggingFunctions.LogStandard(m_Thief, "has stolen a " + iBox.Name + "");
                        }
                        else
                        {
                            m_Thief.SendMessage("You were not quick enough to steal it.");
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED
                        }

                        Item spawnBox = new DungeonChestSpawner(dBox.ContainerLevel, (double)(Utility.RandomMinMax(45, 105)));
                        spawnBox.MoveToWorld(new Point3D(dBox.X, dBox.Y, dBox.Z), dBox.Map);

                        toSteal.Delete();
                    }
                }
                else if (toSteal is LandChest && LandChest.isBody(toSteal.ItemID))
                {
                    m_Thief.SendMessage("It is best to leave the dead be.");
                }
                else if (toSteal is LandChest && !LandChest.isBody(toSteal.ItemID))
                {
                    m_Thief.SendMessage("You would be quite foolish looking stealing a wagon.");
                }
                else if (toSteal is SunkenShip)
                {
                    m_Thief.SendMessage("You are just not that strong.");
                }
                else if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendMessage("You cannot be wielding a weapon when trying to steal something.");
                }
                else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                       // You must be in the thieves guild to steal from other players.
                }
                else if (toSteal is Coffer)
                {
                    Coffer coffer = (Coffer)toSteal;
                    bool   Pilfer = true;

                    if (m_Thief.Backpack.FindItemByType(typeof(ThiefNote)) != null)
                    {
                        Item      mail     = m_Thief.Backpack.FindItemByType(typeof(ThiefNote));
                        ThiefNote envelope = (ThiefNote)mail;

                        if (envelope.NoteOwner == m_Thief)
                        {
                            if (envelope.NoteItemArea == Server.Misc.Worlds.GetRegionName(m_Thief.Map, m_Thief.Location) && envelope.NoteItemGot == 0 && envelope.NoteItemCategory == coffer.CofferType)
                            {
                                envelope.NoteItemGot = 1;
                                m_Thief.LocalOverheadMessage(MessageType.Emote, 1150, true, "You found " + envelope.NoteItem + ".");
                                m_Thief.SendSound(0x3D);
                                envelope.InvalidateProperties();
                                Pilfer = false;
                            }
                        }
                    }

                    if (Pilfer)
                    {
                        if (coffer.CofferGold < 1)
                        {
                            m_Thief.SendMessage("There seems to be no gold in the coffer.");
                        }
                        else if (m_Thief.CheckSkill(SkillName.Stealing, 0, 100))
                        {
                            m_Thief.SendMessage("You slip out " + coffer.CofferGold + " gold from the coffer.");
                            m_Thief.SendSound(0x2E6);
                            m_Thief.AddToBackpack(new Gold(coffer.CofferGold));

                            Titles.AwardFame(m_Thief, (coffer.CofferGold * 2), true);
                            Titles.AwardKarma(m_Thief, -(coffer.CofferGold * 2), true);

                            coffer.CofferRobbed = 1;
                            coffer.CofferRobber = m_Thief.Name + " the " + Server.Misc.GetPlayerInfo.GetSkillTitle(m_Thief);
                            coffer.CofferGold   = 0;

                            LoggingFunctions.LogStandard(m_Thief, "has stolen " + coffer.CofferGold + " gold from a " + coffer.CofferType + " in " + Server.Misc.Worlds.GetRegionName(m_Thief.Map, m_Thief.Location) + "");
                        }
                        else
                        {
                            m_Thief.SendMessage("You fingers slip, causing you to get noticed!");
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED

                            if (!m_Thief.CheckSkill(SkillName.Snooping, 0, 150))
                            {
                                List <Mobile> spotters = new List <Mobile>();
                                foreach (Mobile m in m_Thief.GetMobilesInRange(10))
                                {
                                    if (m is BaseVendor && m.CanSee(m_Thief) && m.InLOS(m_Thief))
                                    {
                                        m_Thief.CriminalAction(false);
                                        m.PublicOverheadMessage(MessageType.Regular, 0, false, string.Format("Stop! Thief!"));
                                    }
                                }
                            }
                        }
                    }
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                       // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor || root is PlayerBarkeeper)
                {
                    m_Thief.SendLocalizedMessage(502709);                       // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                       // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                       // Your backpack can't hold anything else.
                }
                else if (si == null && (toSteal.Parent == null || !toSteal.Movable))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (Core.AOS && si == null && toSteal is Container)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                       // You must be standing next to an item to steal it.
                }
                else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0)
                {
                    m_Thief.SendLocalizedMessage(1060025, "", 0x66D);                       // You're not skilled enough to attempt the theft of this item.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);                       // You cannot steal items which are equipped.
                }
                else if (root == m_Thief)
                {
                    m_Thief.SendLocalizedMessage(502704);                       // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724);                               // You successfully steal the item.

                            Titles.AwardKarma(m_Thief, -1000, true);

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                  // You fail to steal the item.
                            m_Thief.RevealingAction();                             // REVEALING ONLY WHEN FAILED
                        }

                        caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                    }
                }

                return(stolen);
            }
Exemplo n.º 2
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Mobile)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0))
                    {
                        if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild)
                        {
                            from.SendLocalizedMessage(501004);                              //That individual is a thief!
                        }
                        else
                        {
                            from.SendLocalizedMessage(501003);                              //You notice nothing unusual.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determain anything useful.
                    }
                }
                else if (target is Coffer)
                {
                    Coffer coffer = (Coffer)target;

                    if (coffer.CofferRobbed > 0)
                    {
                        from.SendMessage("It seems that " + coffer.CofferRobber + " has robbed this coffer of it's gold!");
                    }
                    else
                    {
                        from.SendMessage("That coffer has not been emptied by thieves.");
                    }
                }
                else if (target is LandChest && LandChest.isBody(((Item)target).ItemID))
                {
                    from.SendMessage("This adventurer looks to have been slain by some wild animal.");
                }
                else if (target is LandChest && !LandChest.isBody(((Item)target).ItemID))
                {
                    from.SendMessage("For some reason, this wagon was left behind.");
                }
                else if (target is WaterChest)
                {
                    from.SendMessage("Maybe the owner of this boat fell into the sea and drowned.");
                }
                else if (target is SunkenShip)
                {
                    from.SendMessage("This ship looks as though it seen better days.");
                }
                else if (target is Corpse)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0))
                    {
                        Corpse c = (Corpse)target;

                        if (c.m_Forensicist != null)
                        {
                            from.SendLocalizedMessage(1042750, c.m_Forensicist);                                // The forensicist  ~1_NAME~ has already discovered that:
                        }
                        else
                        {
                            c.m_Forensicist = from.Name;
                        }

                        if (((Body)c.Amount).IsHuman)
                        {
                            from.SendLocalizedMessage(1042751, (c.Killer == null ? "no one" : c.Killer.Name));                                //This person was killed by ~1_KILLER_NAME~
                        }
                        if (c.Looters.Count > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            for (int i = 0; i < c.Looters.Count; i++)
                            {
                                if (i > 0)
                                {
                                    sb.Append(", ");
                                }
                                sb.Append(((Mobile)c.Looters[i]).Name);
                            }

                            from.SendLocalizedMessage(1042752, sb.ToString());                              //This body has been distrubed by ~1_PLAYER_NAMES~
                        }
                        else
                        {
                            from.SendLocalizedMessage(501002);                              //The corpse has not be desecrated.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determine anything useful.
                    }
                }
                else if (target is ILockpickable)
                {
                    ILockpickable p = (ILockpickable)target;
                    if (p.Picker != null)
                    {
                        from.SendLocalizedMessage(1042749, p.Picker.Name);                          //This lock was opened by ~1_PICKER_NAME~
                    }
                    else
                    {
                        from.SendLocalizedMessage(501003);                          //You notice nothing unusual.
                    }
                }
            }