Exemplo n.º 1
0
        public static void AssignOwner(HonestyItemSocket socket)
        {
            if (socket != null)
            {
                socket.HonestyRegion = _Regions[Utility.Random(_Regions.Length)];

                if (!string.IsNullOrWhiteSpace(socket.HonestyRegion) && BaseVendor.AllVendors.Count >= 10)
                {
                    List <BaseVendor> matchedVendors = new List <BaseVendor>();

                    for (var index = 0; index < BaseVendor.AllVendors.Count; index++)
                    {
                        var vendor = BaseVendor.AllVendors[index];

                        if (vendor.Map == socket.Owner.Map && vendor.Region.IsPartOf(socket.HonestyRegion))
                        {
                            matchedVendors.Add(vendor);
                        }
                    }

                    if (matchedVendors.Count > 0)
                    {
                        socket.HonestyOwner = matchedVendors[Utility.Random(matchedVendors.Count)];
                    }
                    else
                    {
                        // fallback in case there are no vendors generated in the specific region
                        socket.HonestyOwner = BaseVendor.AllVendors[Utility.Random(BaseVendor.AllVendors.Count)];
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool CheckGain(Mobile from, Item item)
        {
            if (from == null || from.Deleted)
            {
                return(false);
            }

            if (item == null || !item.HonestyItem)
            {
                PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1151530, from.NetState); // This is not a lost item.
                return(false);
            }

            Region reg = Region.Find(Location, Map);

            bool gainedPath = false;
            HonestyItemSocket honestySocket = item.GetSocket <HonestyItemSocket>();

            if (honestySocket != null && honestySocket.HonestyRegion == reg.Name)
            {
                VirtueHelper.Award(from, VirtueName.Honesty, 60, ref gainedPath);
            }
            else
            {
                VirtueHelper.Award(from, VirtueName.Honesty, 30, ref gainedPath);
            }

            PrivateOverheadMessage(
                MessageType.Regular,
                0x3B2,
                1151523,
                from.NetState); // You place the item in the lost and found.  You have gained some Honesty!

            if (gainedPath)
            {
                from.SendMessage("You have gained a path in Honesty!");
            }

            item.Delete();

            return(true);
        }
Exemplo n.º 3
0
        public static void AssignOwner(HonestyItemSocket socket)
        {
            if (socket != null)
            {
                socket.HonestyRegion = _Regions[Utility.Random(_Regions.Length)];

                if (!String.IsNullOrWhiteSpace(socket.HonestyRegion) && BaseVendor.AllVendors.Count >= 10)
                {
                    var attempts = BaseVendor.AllVendors.Count / 10;

                    BaseVendor m;

                    do
                    {
                        m = BaseVendor.AllVendors[Utility.Random(BaseVendor.AllVendors.Count)];
                    }while ((m == null || m.Map != socket.Owner.Map || !m.Region.IsPartOf(socket.HonestyRegion)) && --attempts >= 0);

                    socket.HonestyOwner = m;
                }
            }
        }
Exemplo n.º 4
0
        public static void AssignOwner(HonestyItemSocket socket)
        {
            if (socket != null)
            {
                socket.HonestyRegion = _Regions[Utility.Random(_Regions.Length)];

                if (!string.IsNullOrWhiteSpace(socket.HonestyRegion) && BaseVendor.AllVendors.Count >= 10)
                {
                    var matchedVendors = BaseVendor.AllVendors.Where(vendor => (vendor.Map == socket.Owner.Map && vendor.Region.IsPartOf(socket.HonestyRegion))).ToList();

                    if (matchedVendors != null && matchedVendors.Count > 0)
                    {
                        socket.HonestyOwner = matchedVendors[Utility.Random(matchedVendors.Count)];
                    }
                    else
                    {
                        // fallback in case there are no vendors generated in the specific region
                        socket.HonestyOwner = BaseVendor.AllVendors[Utility.Random(BaseVendor.AllVendors.Count)];
                    }
                }
            }
        }
Exemplo n.º 5
0
            protected override void OnTarget(Mobile from, object target)
            {
                double skill    = from.Skills[SkillName.Forensics].Value;
                double minSkill = 30.0;

                if (target is Corpse)
                {
                    if (skill < minSkill)
                    {
                        from.SendLocalizedMessage(501003); //You notice nothing unusual.
                        return;
                    }

                    if (from.CheckTargetSkill(SkillName.Forensics, target, minSkill, 55.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(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 determain anything useful.
                    }
                }
                else if (target is Mobile)
                {
                    if (skill < 36.0)
                    {
                        from.SendLocalizedMessage(501003);//You notice nothing unusual.
                    }
                    else if (from.CheckTargetSkill(SkillName.Forensics, target, 36.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 ILockpickable)
                {
                    if (skill < 41.0)
                    {
                        from.SendLocalizedMessage(501003); //You notice nothing unusual.
                    }
                    else if (from.CheckTargetSkill(SkillName.Forensics, target, 41.0, 100.0))
                    {
                        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.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);//You cannot determain anything useful.
                    }
                }
                else if (target is Item)
                {
                    Item item = (Item)target;

                    if (item is IForensicTarget)
                    {
                        ((IForensicTarget)item).OnForensicEval(from);
                    }
                    else if (skill < 41.0)
                    {
                        from.SendLocalizedMessage(501001);//You cannot determain anything useful.
                        return;
                    }

                    HonestyItemSocket honestySocket = item.GetSocket <HonestyItemSocket>();

                    if (honestySocket != null)
                    {
                        if (honestySocket.HonestyOwner == null)
                        {
                            Server.Services.Virtues.HonestyVirtue.AssignOwner(honestySocket);
                        }

                        if (from.CheckTargetSkill(SkillName.Forensics, target, 41.0, 100.0))
                        {
                            string region = honestySocket.HonestyRegion == null ? "an unknown place" : honestySocket.HonestyRegion;

                            if (from.Skills.Forensics.Value >= 61.0)
                            {
                                from.SendLocalizedMessage(1151521, String.Format("{0}\t{1}", honestySocket.HonestyOwner.Name, region)); // This item belongs to ~1_val~ who lives in ~2_val~.
                            }
                            else
                            {
                                from.SendLocalizedMessage(1151522, region); // You find seeds from a familiar plant stuck to the item which suggests that this item is from ~1_val~.
                            }
                        }
                    }
                }
            }