示例#1
0
        public bool IsPrimeHunt(Mobile from, Point3D p)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null || pm.NpcGuild != NpcGuild.RangersGuild)
            {
                return(false);
            }

            WorldLocationInfo info = WorldLocationInfo.Locations[0][m_BonusIndex];

            if (info != null)
            {
                foreach (Rectangle2D rec in info.Bounds)
                {
                    if (rec.Contains(p))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#2
0
        public bool TryOfferTrade(Mobile from, TradeMinister minister)
        {
            if (from == null || from.Backpack == null)
            {
                return(true);
            }

            if (ActiveTrades.ContainsKey(from))
            {
                minister.SayTo(from, 1151722); // It appears you are already delivering a trade order. Deliver your current order before requesting another.
            }
            else if (KrampusEncounterActive && (KrampusEvent.Instance.Krampus != null || KrampusEvent.Instance.KrampusSpawning))
            {
                Point3D p   = KrampusEvent.Instance.SpawnLocation;
                Map     map = KrampusEvent.Instance.SpawnMap;

                minister.SayTo(
                    from,
                    1158790,
                    string.Format("{0}\t{1}",
                                  WorldLocationInfo.GetLocationString(p, map),
                                  Sextant.GetCoords(p, map)), 1150);
                // Take notice! The vile Krampus has been spotted near ~2_where~ at ~1_coords~!  New Trade Orders are suspended until Krampus has been defeated!
            }
            else
            {
                City origin = minister.City;
                City destination;

                do
                {
                    destination = CityLoyaltySystem.GetRandomCity();
                }while (destination == origin);

                int             distance = GetDistance(minister, destination);
                int             trades   = Utility.RandomMinMax(1, GetMaxTrades(from));
                TradeEntry      entry    = new TradeEntry(destination, origin, distance);
                TradeOrderCrate crate    = new TradeOrderCrate(from, entry);

                GetPlayerEntry <CityTradeEntry>(from as PlayerMobile, true);

                for (int i = 0; i < trades; i++)
                {
                    int    worth = 1;
                    string name  = null;

                    Type t = GetRandomTrade(origin, destination, ref worth, ref name);

                    if (t != null)
                    {
                        if (entry.Details.Any(x => x.ItemType.Name == t.Name))
                        {
                            continue;
                        }

                        int amount = Utility.RandomList(5, 10, 15, 20);
                        entry.Details.Add(new TradeEntry.TradeDetails(t, worth, amount, name));
                    }
                    else
                    {
                        minister.SayTo(from, "There are no trades available at this time.");
                        return(false);
                    }
                }

                if (from.Backpack == null || !from.Backpack.TryDropItem(from, crate, false))
                {
                    crate.Delete();
                    from.SendLocalizedMessage(114456); // Your backpack cannot hold the Trade Order.  Free up space and speak to the Trade Minister again.
                }

                ActiveTrades[from] = crate;

                return(true);
            }

            return(false);
        }
示例#3
0
        private void SpawnKrampus(Mobile m)
        {
            SpawnMap = m.Map;
            var p = m.Location;

            for (int i = 0; i < 25; i++)
            {
                int x = p.X + (Utility.RandomMinMax(-3, 3));
                int y = p.Y + (Utility.RandomMinMax(-3, 3));
                int z = m.Map.GetAverageZ(x, y);

                if (SpawnMap.CanSpawnMobile(x, y, z))
                {
                    p = new Point3D(x, y, z);
                    break;
                }
            }

            SpawnLocation = p;

            foreach (var ns in NetState.Instances)
            {
                var mob = ns.Mobile;

                if (mob != null && CityTradeSystem.HasTrade(mob))
                {
                    mob.LocalOverheadMessage(MessageType.Regular, 1150, 1158832, string.Format("{0}\t{1}", WorldLocationInfo.GetLocationString(SpawnLocation, SpawnMap), Sextant.GetCoords(SpawnLocation, SpawnMap))); // *You sense Krampus has been spotted near ~2_where~ at ~1_coords~!*
                }
            }

            Timer.DelayCall(TimeSpan.FromMinutes(5), () =>
            {
                SpawnKrampus();
            });
        }
示例#4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Corpse)
                {
                    Corpse c = targeted as Corpse;

                    if (!from.InRange(c.Location, 3))
                    {
                        from.SendLocalizedMessage(500446); // That is too far away.
                    }
                    if (c.VisitedByTaxidermist)
                    {
                        from.SendLocalizedMessage(1042596); // That corpse seems to have been visited by a taxidermist already.
                    }
                    else if (!m_Permit.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                    else if (c.Owner == null)
                    {
                        from.SendLocalizedMessage(1155706); // That is not a valid kill.
                    }
                    else if (!IsOnlyAttacker(from, c.Owner))
                    {
                        from.SendLocalizedMessage(1155707);       // You cannot document someone else's kill.
                    }
                    else
                    {
                        Type t = c.Owner.GetType();

                        if (t == typeof(RagingGrizzlyBear)) // Bandaid Fix, we'll keep this until others arise
                        {
                            t = typeof(GrizzlyBear);
                        }

                        for (int i = 0; i < HuntingTrophyInfo.Infos.Count; i++)
                        {
                            HuntingTrophyInfo info = HuntingTrophyInfo.Infos[i];

                            if (t == info.CreatureType)
                            {
                                int v = 0;

                                if (HuntingSystem.Instance != null && HuntingSystem.Instance.IsPrimeHunt(from, c.Location))
                                {
                                    v = Utility.RandomMinMax(0, 100);
                                }
                                else
                                {
                                    v = Utility.RandomMinMax(0, 10000);
                                    v = (int)Math.Sqrt(v);
                                    v = 100 - v;
                                }

                                int measurement = info.MinMeasurement + (int)((double)(info.MaxMeasurement - info.MinMeasurement) * (double)((double)v / 100.0));
                                m_Permit.KillEntry     = new HuntingKillEntry(m_Permit.Owner, measurement, DateTime.Now, i, WorldLocationInfo.GetLocationString(c.Location, c.Map));
                                c.VisitedByTaxidermist = true;

                                from.PlaySound(0x249);
                                from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x45, 1155713, from.NetState); // *You document your kill on the permit*
                                m_Permit.InvalidateProperties();
                                return;
                            }
                        }

                        from.SendLocalizedMessage(1155706); // That is not a valid kill.
                    }
                }
            }