internal static int Drag(Item i, int amount, bool fromClient, bool doLast) { LiftReq lr = new LiftReq(i.Serial, amount, fromClient, doLast); LiftReq prev = null; if (Full) { Log("Queue FULL {0}", lr); World.Player.SendMessage(MsgLevel.Error, LocString.DragDropQueueFull); if (fromClient) { Assistant.Client.Instance.SendToClient(new LiftRej()); } return(0); } Log("Queuing Drag request {0}", lr); if (m_Back >= m_LiftReqs.Length) { m_Back = 0; } if (m_Back <= 0) { prev = m_LiftReqs[m_LiftReqs.Length - 1]; } else if (m_Back <= m_LiftReqs.Length) { prev = m_LiftReqs[m_Back - 1]; } // if the current last req must stay last, then insert this one in its place if (prev != null && prev.DoLast) { Log("Back-Queuing {0}", prev); if (m_Back <= 0) { m_LiftReqs[m_LiftReqs.Length - 1] = lr; } else if (m_Back <= m_LiftReqs.Length) { m_LiftReqs[m_Back - 1] = lr; } // and then re-insert it at the end lr = prev; } m_LiftReqs[m_Back++] = lr; ActionQueue.SignalLift(!fromClient); return(lr.Id); }
public static int Drag(Item i, int amount, bool fromClient, bool doLast) { LiftReq lr = new LiftReq(i.Serial, amount, fromClient, doLast); LiftReq prev = null; if (Full) { if (fromClient) { ClientCommunication.SendToClient(new LiftRej()); } return(0); } Log("Queuing Drag request {0}", lr); if (m_Back >= m_LiftReqs.Length) { m_Back = 0; } if (m_Back <= 0) { prev = m_LiftReqs[m_LiftReqs.Length - 1]; } else if (m_Back <= m_LiftReqs.Length) { prev = m_LiftReqs[m_Back - 1]; } // if the current last req must stay last, then insert this one in its place if (prev != null && prev.DoLast) { Log("Back-Queuing {0}", prev); if (m_Back <= 0) { m_LiftReqs[m_LiftReqs.Length - 1] = lr; } else if (m_Back <= m_LiftReqs.Length) { m_LiftReqs[m_Back - 1] = lr; } // and then re-insert it at the end lr = prev; } m_LiftReqs[m_Back++] = lr; ActionQueue.SignalLift(!fromClient); return(lr.Id); }