Beispiel #1
0
        public override bool DoBeforeRouteCheck()
        {
            // Check if obj close
            if (LookForGameObjClose(_obj))
            {
                // We already at destination
                return(false);
            }

            // Check if obj has coordinates
            Parent.BaseCoord = NpcHelper.GetGameObjCoord(_obj, Parent.Lfs);
            if (Parent.BaseCoord == null)
            {
                throw new GameObjectCoordNotFound(_obj.Name);
            }

            // Check for other coordinates
            if (_obj.GetType().IsSubclassOf(typeof(NPC)))
            {
                NPC npc = (NPC)_obj;

                // Use current zone as a key
                if (npc.Coordinates.Count > 0)
                {
                    ZoneWp zwp = npc.Coordinates[Parent.Player.ZoneText];
                    if (zwp != null)
                    {
                        Parent.Vlist = zwp.List;
                    }
                }
            }

            return(true);
        }
Beispiel #2
0
        protected override void DoExecute(WowPlayer player)
        {
            try
            {
                if (q.State == _start_state)
                {
                    obj = QuestHelper.FindQuestGameObj(req, q, lfs);
                }
                else if (q.State == _end_state)
                {
                    Finish(player);
                }
                else
                {
                    switch (q.State)
                    {
                    case QuestStates.OBJ_FOUND:
                        Vector3D dest = NpcHelper.GetGameObjCoord(obj, lfs);

                        // Switch to Travel State
                        string msg = "Moving to quest " +
                                     req.NpcDestText + " " + obj.Name;
                        Log(lfs, msg + " ...");
                        NavigationState ns = new NavigationState(dest, lfs, msg);

                        ns.Finished += SetQuestStateReached;
                        CallChangeStateEvent(player, ns, true, false);

                        q.State = QuestStates.MOVING_TO_OBJ;
                        break;

                    case QuestStates.MOVING_TO_OBJ:
                        // Do nothing
                        break;

                    // Keep it for now but works for NPC only
                    case QuestStates.OBJ_REACHED:
                        // Target game object
                        NpcHelper.TargetGameObj(obj, lfs);
                        q.State = QuestStates.OBJ_TARGETED;
                        break;

                    case QuestStates.OBJ_TARGETED:
                        QuestHelper.SelectGameObjQuest(req, obj, q, lfs);
                        break;

                    case QuestStates.SELECTED:
                        QuestHelper.DoActionEx(req, q, lfs);
                        break;

                    default:
                        throw new QuestSkipException("Unknown quest state: " +
                                                     Enum.GetName(typeof(QuestStates), q.State));
                    }
                }
            }
            catch // For now skip quest on any exception
            {
                SkipQuest(player);
            }
        }