Ejemplo n.º 1
0
        // 11Apr2013-04:42UTC chinajade
        public static SafePathType GetOrCreate(XElement parentElement, string elementName, double defaultEgressDistance, Vector3?safespotLocation = null)
        {
            if (safespotLocation.HasValue &&
                ((safespotLocation.Value == Vector3.Zero) || safespotLocation.Value == Vector3.Zero))
            {
                safespotLocation = null;
            }

            var safePath = new SafePathType(parentElement
                                            .Elements()
                                            .DefaultIfEmpty(new XElement(elementName))
                                            .FirstOrDefault(elem => (elem.Name == elementName)),
                                            defaultEgressDistance);

            if (!safePath.IsAttributeProblem)
            {
                // If user didn't provide a HuntingGrounds, and he provided a default center point, add it...
                if (!safePath.Waypoints.Any() && safespotLocation.HasValue)
                {
                    safePath.Waypoints.Add(new WaypointType(safespotLocation.Value, "safe spot", 7.0));
                }

                if (!safePath.Waypoints.Any())
                {
                    QBCLog.Error("Neither the X/Y/Z attributes nor the <{0}> sub-element has been specified.",
                                 elementName);
                    safePath.IsAttributeProblem = true;
                }
            }

            return(safePath);
        }
Ejemplo n.º 2
0
        // 11Apr2013-04:42UTC chinajade
        public static SafePathType GetOrCreate(XElement parentElement, string elementName, double defaultEgressDistance, WoWPoint? safespotLocation = null)
        {
            if (safespotLocation.HasValue
                && ((safespotLocation.Value == WoWPoint.Empty) || safespotLocation.Value == WoWPoint.Zero))
            {
                safespotLocation = null;
            }

            var safePath = new SafePathType(parentElement
                                                .Elements()
                                                .DefaultIfEmpty(new XElement(elementName))
                                                .FirstOrDefault(elem => (elem.Name == elementName)),
                                              defaultEgressDistance);

            if (!safePath.IsAttributeProblem)
            {
                // If user didn't provide a HuntingGrounds, and he provided a default center point, add it...
                if (!safePath.Waypoints.Any() && safespotLocation.HasValue)
                    { safePath.AppendWaypoint(safespotLocation.Value, "safe spot", Navigator.PathPrecision); }

                if (!safePath.Waypoints.Any())
                {
                    QuestBehaviorBase.LogError("Neither the X/Y/Z attributes nor the <{0}> sub-element has been specified.",
                                elementName);
                    safePath.IsAttributeProblem = true;
                }
            }

            return safePath;
        }