/// <summary>Sends the given Character on the given Path.</summary> /// <param name="chr">The Character to fly around.</param> /// <param name="destinations">An array of destination TaxiNodes.</param> /// <returns>Whether the client was sent on its way.</returns> internal static bool TryFly(Character chr, NPC vendor, PathNode[] destinations) { IRealmClient client = chr.Client; if (vendor == null && chr.Role.IsStaff) { PathNode pathNode = ((IEnumerable <PathNode>)destinations).LastOrDefault <PathNode>(); if (pathNode == null) { return(false); } chr.TeleportTo((IWorldLocation)pathNode); return(true); } if (vendor == null || !vendor.CheckVendorInteraction(chr)) { TaxiHandler.SendActivateTaxiReply((IPacketReceiver)client, TaxiActivateResponse.NotAvailable); } else if (TaxiMgr.PreFlightCheatChecks(client, destinations) && TaxiMgr.PreFlightValidPathCheck(client, destinations) && (client.ActiveCharacter.GodMode || TaxiMgr.PreFlightMoneyCheck(client))) { TaxiHandler.SendActivateTaxiReply((IPacketReceiver)client, TaxiActivateResponse.Ok); chr.UpdatePvPState(false, true); TaxiMgr.FlyUnit((Unit)chr, true); return(true); } return(false); }
/// <summary>Send character down the next leg of a multi-hop trip.</summary> internal static void ContinueFlight(Unit unit) { if (unit.LatestTaxiPathNode == null) { return; } PathVertex pathVertex = unit.LatestTaxiPathNode.Value; PathNode to = pathVertex.Path.To; if (unit.m_TaxiMovementTimer.IsRunning && !unit.IsInRadius(to.Position, (float)TaxiMgr.AirSpeed)) { return; } bool flag = false; if (unit.TaxiPaths.Count < 2) { flag = true; } else { if (unit.TaxiPaths.Dequeue().To != to) { unit.CancelTaxiFlight(); return; } TaxiPath taxiPath = unit.TaxiPaths.Peek(); if (to != taxiPath.From) { unit.CancelTaxiFlight(); return; } } if (!flag) { TaxiMgr.FlyUnit(unit, false); } else { if (TaxiMgr.IsNormalSpeed) { unit.Map.MoveObject((WorldObject)unit, pathVertex.Pos); } else { unit.TeleportTo(pathVertex.Pos); } unit.CancelTaxiFlight(); } }
public static void FlyUnit(Unit chr, bool startFlight) { TaxiMgr.FlyUnit(chr, startFlight, (LinkedListNode <PathVertex>)null); }