Exemple #1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 1:
            {
                if (m_Node.Parent != null)
                {
                    from.SendGump(new GoGump(0, from, m_Tree, m_Node.Parent));
                }

                break;
            }

            case 2:
            {
                if (m_Page > 0)
                {
                    from.SendGump(new GoGump(m_Page - 1, from, m_Tree, m_Node));
                }

                break;
            }

            case 3:
            {
                if ((m_Page + 1) * EntryCount < m_Node.Children.Length)
                {
                    from.SendGump(new GoGump(m_Page + 1, from, m_Tree, m_Node));
                }

                break;
            }

            default:
            {
                int index = info.ButtonID - 4;

                if (index >= 0 && index < m_Node.Children.Length)
                {
                    object o = m_Node.Children[index];

                    if (o is ParentNode)
                    {
                        from.SendGump(new GoGump(0, from, m_Tree, (ParentNode)o));
                    }
                    else
                    {
                        ChildNode n = (ChildNode)o;

                        from.MoveToWorld(n.Location, m_Tree.Map);
                    }
                }

                break;
            }
            }
        }
Exemple #2
0
		private void Parse( XmlTextReader xml )
		{
			if ( xml.MoveToAttribute( "name" ) )
				m_Name = xml.Value;
			else
				m_Name = "empty";

			if ( xml.IsEmptyElement )
			{
				m_Children = new object[0];
			}
			else
			{
				ArrayList children = new ArrayList();

				while ( xml.Read() && xml.NodeType == XmlNodeType.Element )
				{
					if ( xml.Name == "child" )
					{
						ChildNode n = new ChildNode( xml, this );

						children.Add( n );
					}
					else
					{
						children.Add( new ParentNode( xml, this ) );
					}
				}

				m_Children = children.ToArray();
			}
		}
Exemple #3
0
        public static void GetDiscoveredLocation(PlayerMobile from)
        {
            var discobertas = from.CampfireLocations.Split(';').ToList();
            var childs      = GetAllChildsCamping();

            double menorDist = 999999999999999999;

            ChildNode prox = null;

            foreach (var loc in childs)
            {
                if (!discobertas.Contains(loc.Name))
                {
                    var distancia = from.GetDistanceToSqrt(loc.Location);
                    if (distancia < 600)
                    {
                        if (distancia < menorDist)
                        {
                            menorDist = distancia;
                            prox      = loc;
                        }
                    }
                }
            }

            if (prox != null)
            {
                from.CampfireLocations += prox.Name + ";";
                from.Emote("Local de Camping Descoberto: " + prox.Name);
            }
        }
        private void Parse(XmlTextReader xml)
        {
            if (xml.MoveToAttribute("name"))
            {
                this.m_Name = xml.Value;
            }
            else
            {
                this.m_Name = "empty";
            }

            if (xml.IsEmptyElement)
            {
                this.m_Children = new object[0];
            }
            else
            {
                ArrayList children = new ArrayList();

                while (xml.Read() && (xml.NodeType == XmlNodeType.Element || xml.NodeType == XmlNodeType.Comment))
                {
                    if (xml.NodeType == XmlNodeType.Comment)
                    {
                        continue;
                    }

                    if (xml.Name == "child")
                    {
                        ChildNode n = new ChildNode(xml, this);

                        children.Add(n);
                    }
                    else
                    {
                        children.Add(new ParentNode(xml, this));
                    }
                }

                this.m_Children = children.ToArray();
            }
        }