示例#1
0
        /// <summary>
        /// Returns all Nodes matching the arguments in the given trigger.
        /// </summary>
        /// <param name="trigger">[part of name|id]</param>
        /// <returns></returns>
        public static List <PathNode> GetNodes(CmdTrigger <RealmServerCmdArgs> trigger)
        {
            string          s            = trigger.Text.NextWord();
            List <PathNode> pathNodeList = new List <PathNode>();
            uint            result;

            if (uint.TryParse(s, out result))
            {
                PathNode node = TaxiMgr.GetNode(result);
                if (node == null)
                {
                    trigger.Reply("Invalid Id: " + result);
                    return(pathNodeList);
                }

                pathNodeList.Add(node);
            }
            else if (s.Length > 0)
            {
                foreach (PathNode pathNode in TaxiMgr.PathNodesById)
                {
                    if (pathNode != null && pathNode.Name.IndexOf(s, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    {
                        pathNodeList.Add(pathNode);
                    }
                }
            }
            else
            {
                foreach (PathNode pathNode in TaxiMgr.PathNodesById)
                {
                    if (pathNode != null)
                    {
                        pathNodeList.Add(pathNode);
                    }
                }
            }

            if (pathNodeList.Count == 0)
            {
                if (s.Length > 0)
                {
                    trigger.Reply("Invalid Node-name: " + s);
                }
                else
                {
                    trigger.Reply("No Node.");
                }
            }

            return(pathNodeList);
        }
示例#2
0
        /// <summary>
        /// Returns all Nodes matching the arguments in the given trigger.
        /// </summary>
        /// <param name="trigger">[part of name|id]</param>
        /// <returns></returns>
        public static List <PathNode> GetNodes(CmdTrigger <RealmServerCmdArgs> trigger)
        {
            var  name = trigger.Text.NextWord();
            var  list = new List <PathNode>();
            uint id;

            if (uint.TryParse(name, out id))
            {
                var node = TaxiMgr.GetNode(id);
                if (node == null)
                {
                    trigger.Reply("Invalid Id: " + id);
                    return(list);
                }
                list.Add(node);
            }
            else if (name.Length > 0)
            {
                foreach (var node in TaxiMgr.PathNodesById)
                {
                    if (node != null && node.Name.IndexOf(name, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    {
                        list.Add(node);
                    }
                }
            }
            else
            {
                foreach (var node in TaxiMgr.PathNodesById)
                {
                    if (node != null)
                    {
                        list.Add(node);
                    }
                }
            }
            if (list.Count == 0)
            {
                if (name.Length > 0)
                {
                    trigger.Reply("Invalid Node-name: " + name);
                }
                else
                {
                    trigger.Reply("No Node.");
                }
            }
            return(list);
        }