Ejemplo n.º 1
0
 protected Composite Behavior()
 {
     return(new PrioritySelector(
                new Decorator(ret => QuestId != 0 && QuestLogManager.GetQuestById(QuestId).Step > StepId,
                              new Action(r =>
     {
         Poi.Clear("Exiting SmartMove tag");
         _done = true;
     })
                              ),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance,
                              new Action(ret =>
     {
         MovementManager.MoveForwardStop();
         Poi.Clear("Exiting SmartMove tag");
         _done = true;
     }
                                         )
                              ),
                new Decorator(ret => Talk.DialogOpen,
                              new Action(ret => Talk.Next())
                              ),
                new Decorator(ret => !UseMesh,
                              new Action(ret => Navigator.PlayerMover.MoveTowards(Position))
                              ),
                new Decorator(ret => UseMesh,
                              CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name)
                              ),
                new ActionAlwaysSucceed()
                ));
 }
Ejemplo n.º 2
0
 protected Composite Behavior()
 {
     return(new PrioritySelector(
                new Decorator(ret => Condition != null && !ConditionCheck(),
                              new Action(ret => _done = true)),
                new Decorator(ret => QuestId != 0 && StepId != 0 && QuestLogManager.GetQuestById(QuestId).Step > StepId,
                              new Action(r =>
     {
         _done = true;
     })
                              ),
                new Decorator(ret => Core.Player.IsMounted,
                              CommonBehaviors.Dismount()
                              ),
                new Decorator(ret => Talk.DialogOpen,
                              new Action(r =>
     {
         Talk.Next();
     })
                              ),
                new Decorator(ret => casted,
                              new Sequence(
                                  new Sleep(3, 5),
                                  new Action(r => casted = false)
                                  )
                              ),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && IsFinished,
                              new Action(ret => _done = true)),
                new Decorator(ret => Core.Me.Location.Distance(Position) <= Distance && !casted,
                              new Action(r =>
     {
         Navigator.PlayerMover.MoveStop();
         if (!Core.Player.IsCasting)
         {
             GameObjectManager.GetObjectByNPCId(NPC).Face();
             if (ActionManager.DoAction(SpellID, GameObjectManager.GetObjectByNPCId(NPC)))
             {
                 ActionManager.DoAction(SpellID, GameObjectManager.GetObjectByNPCId(NPC));
                 casted = true;
             }
             else
             {
                 ActionManager.DoActionLocation(SpellID, Core.Player.Location);
                 casted = true;
             }
         }
     })
                              ),
                CommonBehaviors.MoveAndStop(ret => Position, Distance, stopInRange: true, destinationName: Name),
                new ActionAlwaysSucceed()
                ));
 }
Ejemplo n.º 3
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       new Decorator(ret => !Sent && !string.IsNullOrEmpty(Message) && ATEntry == -1,
                                     new Action(r =>
            {
                ChatManager.SendChat(Message);
                Sent = true;
                if (StepId == 0 && QuestId == 0)
                {
                    _done = true;
                }
            })
                                     ),
                       new Decorator(ret => !Sent && string.IsNullOrEmpty(Message) && ATEntry != -1 && ATSubEntry != -1,
                                     new Action(r =>
            {
                // Set up injection
                IntPtr edit = Core.Memory.Process.MainWindowHandle;
                const uint WM_KEYDOWN = 0x100;
                const uint WM_KEYUP = 0x0101;
                const uint WM_CHAR = 0x0102;

                // Send keys
                PostMessage(edit, WM_KEYDOWN, (IntPtr)(Keys.Enter), IntPtr.Zero);
                PostMessage(edit, WM_KEYUP, (IntPtr)(Keys.Enter), IntPtr.Zero);
                Thread.Sleep(500);
                PostMessage(edit, WM_KEYDOWN, (IntPtr)(Keys.Tab), IntPtr.Zero);
                PostMessage(edit, WM_KEYUP, (IntPtr)(Keys.Tab), IntPtr.Zero);
                Thread.Sleep(500);
                PostMessage(edit, WM_KEYDOWN, (IntPtr)(GetKey(ATEntry)), IntPtr.Zero);
                PostMessage(edit, WM_KEYUP, (IntPtr)(GetKey(ATEntry)), IntPtr.Zero);
                Thread.Sleep(500);
                // If it's not on the first page, navigate to the correct page
                if (Page > 1)
                {
                    int i = 1;
                    while (i < Page)
                    {
                        PostMessage(edit, WM_KEYDOWN, (IntPtr)(Keys.Right), IntPtr.Zero);
                        PostMessage(edit, WM_KEYUP, (IntPtr)(Keys.Right), IntPtr.Zero);
                        Thread.Sleep(500);
                        i++;
                    }
                }
                PostMessage(edit, WM_KEYDOWN, (IntPtr)(GetKey(ATSubEntry)), IntPtr.Zero);
                PostMessage(edit, WM_KEYUP, (IntPtr)(GetKey(ATSubEntry)), IntPtr.Zero);
                Thread.Sleep(500);
                PostMessage(edit, WM_KEYDOWN, (IntPtr)(Keys.Enter), IntPtr.Zero);
                PostMessage(edit, WM_KEYUP, (IntPtr)(Keys.Enter), IntPtr.Zero);
                Thread.Sleep(500);

                // Clean up
                Sent = true;
                if (StepId == 0 && QuestId == 0)
                {
                    _done = true;
                }
            })
                                     ),
                       new Decorator(ret => QuestLogManager.GetQuestById(QuestId).Step == StepId,
                                     new ActionAlwaysSucceed()
                                     ),
                       new Decorator(ret => QuestLogManager.GetQuestById(QuestId).Step > StepId,
                                     new Action(r =>
            {
                _done = true;
            })
                                     )
                       ));
        }