protected override void OnTick() { if (!m_Arrow.Running) { Stop(); return; } else if (m_From.NetState == null || m_From.Alive || m_From.Deleted || m_Target.Deleted || !m_From.InRange(m_Target, m_Range) || GhostHelper.SameArea(m_From, m_Target) == false) { m_Arrow.Stop(); Stop(); if (!m_From.Alive) { GhostHelper.OnGhostWalking(m_From); } return; } if (m_LastX != m_Target.X || m_LastY != m_Target.Y) { m_LastX = m_Target.X; m_LastY = m_Target.Y; m_Arrow.Update(); } }
public static void Corpse_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; if (!from.Alive) { from.SendMessage("You are dead and cannot do that!"); return; } Map map = from.Map; if (map == null) { return; } int range = 1000; // 1000 TILES AWAY int HowFarAway = 0; int TheClosest = 1000000; int IsClosest = 0; int distchk = 0; int distpck = 0; ArrayList bodies = new ArrayList(); ArrayList empty = new ArrayList(); ArrayList mice = new ArrayList(); foreach (Item body in from.GetItemsInRange(range)) { if (body is Corpse) { Corpse cadaver = (Corpse)body; int carrying = body.GetTotal(TotalType.Items); Mobile mSp = new CorpseCritter(); mSp.MoveToWorld(new Point3D(body.X, body.Y, body.Z), body.Map); if (GhostHelper.SameArea(from, mSp) == true && cadaver.Owner == from && carrying > 0) { distchk++; bodies.Add(mSp); if (GhostHelper.HowFar(from.X, from.Y, mSp.X, mSp.Y) < TheClosest) { TheClosest = GhostHelper.HowFar(from.X, from.Y, mSp.X, mSp.Y); IsClosest = distchk; } } else if (cadaver.Owner == from && carrying < 1) { empty.Add(body); mice.Add(mSp); } } } for (int h = 0; h < bodies.Count; ++h) { distpck++; if (distpck == IsClosest) { Mobile theBody = ( Mobile )bodies[h]; HowFarAway = GhostHelper.HowFar(from.X, from.Y, theBody.X, theBody.Y); from.QuestArrow = new CorpseArrow(from, theBody, HowFarAway * 2); } } for (int u = 0; u < empty.Count; ++u) { Item theEmpty = ( Item )empty[u]; theEmpty.Delete(); } for (int m = 0; m < mice.Count; ++m) { Mobile theMouse = ( Mobile )mice[m]; theMouse.Delete(); } if (distchk == 0) { from.SendMessage("You have no nearby corpse in this area!"); } }