static bool HandleGoTaxinodeCommand(StringArguments args, CommandHandler handler) { Player player = handler.GetSession().GetPlayer(); if (args.Empty()) { return(false); } string id = handler.extractKeyFromLink(args, "Htaxinode"); if (string.IsNullOrEmpty(id)) { return(false); } if (!uint.TryParse(id, out uint nodeId) || nodeId == 0) { return(false); } TaxiNodesRecord node = CliDB.TaxiNodesStorage.LookupByKey(nodeId); if (node == null) { handler.SendSysMessage(CypherStrings.CommandGotaxinodenotfound, nodeId); return(false); } if ((node.Pos.X == 0.0f && node.Pos.Y == 0.0f && node.Pos.Z == 0.0f) || !GridDefines.IsValidMapCoord(node.ContinentID, node.Pos.X, node.Pos.Y, node.Pos.Z)) { handler.SendSysMessage(CypherStrings.InvalidTargetCoord, node.Pos.X, node.Pos.Y, node.ContinentID); return(false); } // stop flight if need if (player.IsInFlight()) { player.GetMotionMaster().MovementExpired(); player.CleanupAfterTaxiFlight(); } // save only in non-flight case else { player.SaveRecallPosition(); } player.TeleportTo(node.ContinentID, node.Pos.X, node.Pos.Y, node.Pos.Z, player.GetOrientation()); return(true); }
void HandleMoveSplineDoneOpcode(MoveSplineDone moveSplineDone) { MovementInfo movementInfo = moveSplineDone.Status; _player.ValidateMovementInfo(movementInfo); // in taxi flight packet received in 2 case: // 1) end taxi path in far (multi-node) flight // 2) switch from one map to other in case multim-map taxi path // we need process only (1) uint curDest = GetPlayer().m_taxi.GetTaxiDestination(); if (curDest != 0) { TaxiNodesRecord curDestNode = CliDB.TaxiNodesStorage.LookupByKey(curDest); // far teleport case if (curDestNode != null && curDestNode.ContinentID != GetPlayer().GetMapId()) { if (GetPlayer().GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Flight) { // short preparations to continue flight FlightPathMovementGenerator flight = (FlightPathMovementGenerator)GetPlayer().GetMotionMaster().Top(); flight.SetCurrentNodeAfterTeleport(); TaxiPathNodeRecord node = flight.GetPath()[(int)flight.GetCurrentNode()]; flight.SkipCurrentNode(); GetPlayer().TeleportTo(curDestNode.ContinentID, node.Loc.X, node.Loc.Y, node.Loc.Z, GetPlayer().GetOrientation()); } } return; } // at this point only 1 node is expected (final destination) if (GetPlayer().m_taxi.GetPath().Count != 1) { return; } GetPlayer().CleanupAfterTaxiFlight(); GetPlayer().SetFallInformation(0, GetPlayer().GetPositionZ()); if (GetPlayer().pvpInfo.IsHostile) { GetPlayer().CastSpell(GetPlayer(), 2479, true); } }
uint GetVertexIDFromNodeID(TaxiNodesRecord node) { return(m_verticesByNode.ContainsKey(node.Id) ? m_verticesByNode[node.Id] : uint.MaxValue); }
void HandleActivateTaxi(ActivateTaxi activateTaxi) { Creature unit = GetPlayer().GetNPCIfCanInteractWith(activateTaxi.Vendor, NPCFlags.FlightMaster); if (unit == null) { Log.outDebug(LogFilter.Network, "WORLD: HandleActivateTaxiOpcode - {0} not found or you can't interact with it.", activateTaxi.Vendor.ToString()); SendActivateTaxiReply(ActivateTaxiReply.TooFarAway); return; } uint curloc = Global.ObjectMgr.GetNearestTaxiNode(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetMapId(), GetPlayer().GetTeam()); if (curloc == 0) { return; } TaxiNodesRecord from = CliDB.TaxiNodesStorage.LookupByKey(curloc); TaxiNodesRecord to = CliDB.TaxiNodesStorage.LookupByKey(activateTaxi.Node); if (to == null) { return; } if (!GetPlayer().isTaxiCheater()) { if (!GetPlayer().m_taxi.IsTaximaskNodeKnown(curloc) || !GetPlayer().m_taxi.IsTaximaskNodeKnown(activateTaxi.Node)) { SendActivateTaxiReply(ActivateTaxiReply.NotVisited); return; } } uint preferredMountDisplay = 0; MountRecord mount = CliDB.MountStorage.LookupByKey(activateTaxi.FlyingMountID); if (mount != null) { if (GetPlayer().HasSpell(mount.SourceSpellID)) { var mountDisplays = Global.DB2Mgr.GetMountDisplays(mount.Id); if (mountDisplays != null) { List <MountXDisplayRecord> usableDisplays = mountDisplays.Where(mountDisplay => { PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(mountDisplay.PlayerConditionID); if (playerCondition != null) { return(ConditionManager.IsPlayerMeetingCondition(GetPlayer(), playerCondition)); } return(true); }).ToList(); if (!usableDisplays.Empty()) { preferredMountDisplay = usableDisplays.SelectRandom().CreatureDisplayInfoID; } } } } List <uint> nodes = new List <uint>(); Global.TaxiPathGraph.GetCompleteNodeRoute(from, to, GetPlayer(), nodes); GetPlayer().ActivateTaxiPathTo(nodes, unit, 0, preferredMountDisplay); }
uint GetVertexIDFromNodeID(TaxiNodesRecord node) { return(node.LearnableIndex); }
uint GetVertexIDFromNodeID(TaxiNodesRecord node) { return(node.CharacterBitNumber); }