Exemplo n.º 1
0
        //Old Salty - added OnThink override
        public override void OnThink()
        {
            if (Combatant != null && Combatant != Focus)
            {
                Focus = Combatant;
            }

            // check to see if any groundskeepers need to be spawned
            try
            {
                Groundskeeper.DoGroundskeeper(this);
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }

            base.OnThink();
        }
Exemplo n.º 2
0
        private static bool DoScan(Mobile m, GroundskeeperStatus al, ArrayList list)
        {
            al.LastScan = DateTime.Now;
            TimeSpan threshold = new TimeSpan(0, 3, 0);                         // age of item on the ground before we care
            int      trash     = 0;

            foreach (Item item in m.GetItemsInRange(12)) // 12 tiles?
            {                                            // is this trash? No LOS checks here because the manager won't be trying to pick it up
                if (Groundskeeper.IgnoreFilter(item, threshold))
                {
                    continue;
                }

                list.Add(item);                                                                 // add it
            }

            // post process list to allow things like a couple marked runes
            Groundskeeper.AllowFilter(list);
            trash = list.Count;                 // total trash after removing allowed items

            // Keep only representative items from different Zs by deleting all items except those with unique Zs
            ArrayList temp = new ArrayList();

            foreach (Item ix in list)
            {
                temp.Add(ix);
            }

            // only spawn 1 groundskeeper per Z plane and only when those Z planes are not within LOS.
            //	Example: a stack of scales will be on different Z panes, but within LOS (reachable by the same groundskeeper.)
            foreach (Item ix in temp)
            {
                if (!DifferentZ(list, ix as Item))
                {
                    list.Remove(ix);
                }
            }

            // did the scan find enough trash to pick up?
            //	if someone drops a handful of stuff (< 5 items), ignore it
            return(trash > 5);
        }
Exemplo n.º 3
0
        private static void DoSpawn(GroundskeeperStatus al, ArrayList list)
        {
            al.LastSpawn = DateTime.Now;
            foreach (Item ix in list)
            {
                if (ix is Item)
                {                       // first see if there is already a grounds keeper on the job.
                    Sector sector         = ix.Map.GetSector(ix.X, ix.Y);
                    bool   alreadyHandled = false;
                    foreach (Mobile mx in sector.Mobiles.Values)
                    {
                        if (mx == null)
                        {
                            continue;
                        }

                        if (mx is Groundskeeper && mx.Deleted == false)
                        {
                            if (((mx as Groundskeeper).GetDistanceToSqrt(ix) < 12) && ((mx as Groundskeeper).InLOS(ix)))
                            {   // If the grounds keeper can see the Item, then he's already working on it.
                                alreadyHandled = true;
                                break;
                            }
                        }
                    }
                    // if there is no groundskeeper on the job, spawn a new one
                    if (alreadyHandled == false)
                    {
                        Groundskeeper m = new Groundskeeper();
                        m.Home      = ix.Location;                                      // setup the groundskeeper's home
                        m.RangeHome = 10;                                               // this is the default for a mobile, but I'd like to be explicit here
                        Point3D location = SpawnClose(ix, m);                           // spawn as close as possible
                        m.MoveToWorld(location, ix.Map);
                        Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                        m.PlaySound(0x1FE);
                    }
                }
            }
        }
Exemplo n.º 4
0
		private static void DoSpawn(GroundskeeperStatus al, ArrayList list)
		{
			al.LastSpawn = DateTime.Now;
			foreach (Item ix in list)
				if (ix is Item)
				{	// first see if there is already a grounds keeper on the job.
					Sector sector = ix.Map.GetSector(ix.X, ix.Y);
					bool alreadyHandled = false;
					foreach (Mobile mx in sector.Mobiles.Values)
                    {
                        if (mx == null)
                            continue;

                        if (mx is Groundskeeper && mx.Deleted == false)
                            if (((mx as Groundskeeper).GetDistanceToSqrt(ix) < 12) && ((mx as Groundskeeper).InLOS(ix)))
                            {	// If the grounds keeper can see the Item, then he's already working on it.
                                alreadyHandled = true;
                                break;
                            }
                    }
					// if there is no groundskeeper on the job, spawn a new one
					if (alreadyHandled == false)
					{
						Groundskeeper m = new Groundskeeper();
						m.Home = ix.Location;					// setup the groundskeeper's home
						m.RangeHome = 10;						// this is the default for a mobile, but I'd like to be explicit here
						Point3D location = SpawnClose(ix, m);	// spawn as close as possible
						m.MoveToWorld(location, ix.Map);
						Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
						m.PlaySound(0x1FE);
					}
				}
		}