• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • [Plugin - BETA] RaF Quester, a party questing plugin

    Discussion in 'Leveling' started by Theking, Feb 15, 2014.

    1. MajestatisPluralis

      MajestatisPluralis New Member

      Joined:
      Sep 8, 2012
      Messages:
      231
      Likes Received:
      0
      Trophy Points:
      0
      hi there,

      currently Im tesing your plugin. nice work, but why do them always wait after a quest was turned in? 5 times and it noticed there is a loop, could you fix that?
       
      Last edited: May 24, 2014
    2. hackersrage

      hackersrage Member Buddy Store Developer

      Joined:
      Nov 18, 2012
      Messages:
      342
      Likes Received:
      15
      Trophy Points:
      18
      The repo > https://raf-quester.googlecode.com/svn/RaFQuester/ < is asking for a username and password now. When going to 'raf-quester.googlecode.com' directly, I get page not found.

      Seems like this was an awesome idea, and was making good progress, but svn access would be nice to have again please.
       
    3. Macatho

      Macatho New Member

      Joined:
      Dec 3, 2011
      Messages:
      1,108
      Likes Received:
      18
      Trophy Points:
      0
      Seems to work flawlessly except for the fact that HB crashes all the time. Maybe it cant handle 3 characters dinging at the same time. Might try different HB installations. see if that fixes it.
       
    4. namednoob

      namednoob Community Developer

      Joined:
      Apr 25, 2014
      Messages:
      1,097
      Likes Received:
      25
      Trophy Points:
      38
      I believe the problem is all those "Thread.Sleep" causing it to crash, also it will interact with the NPCs so many times in a short period of time while waiting for the other bots that is not a normal thing I would be careful with that.
       
    5. PePPeRmix

      PePPeRmix Community Developer

      Joined:
      Mar 28, 2014
      Messages:
      137
      Likes Received:
      1
      Trophy Points:
      18
      Agree with you, at the momen for me i searching another way for w8ing party members.
      and Macatho, different folders doesn't rescue you, becouse i use defferent folders allways, and have same crashes a lot of time... =(
       
    6. Jidgo

      Jidgo New Member

      Joined:
      May 31, 2014
      Messages:
      1
      Likes Received:
      0
      Trophy Points:
      0
      Well atleast I am not the only one with a crashing client. Tried to RAF-Quest 3 alts.
       
    7. razer

      razer New Member

      Joined:
      Apr 29, 2012
      Messages:
      1,347
      Likes Received:
      7
      Trophy Points:
      0
      Just keeps crashing even with only 2 accounts....Damn was hoping it was going to work straight up.
       
    8. Grinern

      Grinern New Member

      Joined:
      Apr 7, 2014
      Messages:
      6
      Likes Received:
      0
      Trophy Points:
      0
      Can i use it with Dungeonbuddy, has someone had eany experience using it with the quests in dungeons ?
       
    9. namednoob

      namednoob Community Developer

      Joined:
      Apr 25, 2014
      Messages:
      1,097
      Likes Received:
      25
      Trophy Points:
      38
      DungeonBuddy already take dungeon quests you have options for that you dont need this plugin.

      They are usually in range when turning as well.
       
    10. razer

      razer New Member

      Joined:
      Apr 29, 2012
      Messages:
      1,347
      Likes Received:
      7
      Trophy Points:
      0
      anyone got a fix for the crashing with this yet?
       
    11. kuw84

      kuw84 New Member

      Joined:
      Dec 6, 2010
      Messages:
      267
      Likes Received:
      0
      Trophy Points:
      0
      Looks like we're gonna have to fork out cash to get this one again. The SVN requires auth or is down. lol
       
    12. hackersrage

      hackersrage Member Buddy Store Developer

      Joined:
      Nov 18, 2012
      Messages:
      342
      Likes Received:
      15
      Trophy Points:
      18
      I modified this plugin so it uses Coroutine.Sleep() instead of Thread.Sleep() as per compatability guidelines for correct pausing of the thread in an HonorBuddy plugin/bot.

      View attachment 133326

      This is not tested, however it *should* work fine and resolve the crashing issues. I also removed a duplicate OR condition for checking quest status.
       
    13. kuw84

      kuw84 New Member

      Joined:
      Dec 6, 2010
      Messages:
      267
      Likes Received:
      0
      Trophy Points:
      0
      Thumbs the fuck up! You've inspired me to grab 5 battle chests :)
       
    14. namednoob

      namednoob Community Developer

      Joined:
      Apr 25, 2014
      Messages:
      1,097
      Likes Received:
      25
      Trophy Points:
      38
      And if you use Visual Studio it did not trigger you the warning about how you're using your async?

      Edit:
      Also you forgot to add void after async and to add the using for coroutines and tasks.
       
      Last edited: Jun 18, 2014
    15. hackersrage

      hackersrage Member Buddy Store Developer

      Joined:
      Nov 18, 2012
      Messages:
      342
      Likes Received:
      15
      Trophy Points:
      18
      Sorry... edited it in Notepad ... lol. change was a simple one. Post code blocks on what it should be please. :)
       
    16. razer

      razer New Member

      Joined:
      Apr 29, 2012
      Messages:
      1,347
      Likes Received:
      7
      Trophy Points:
      0
      For some reason honorbuddy is not reading it.
       
      Last edited: Jun 18, 2014
    17. hackersrage

      hackersrage Member Buddy Store Developer

      Joined:
      Nov 18, 2012
      Messages:
      342
      Likes Received:
      15
      Trophy Points:
      18
      Okay guys, I have made some adjustments. Sorry it took me a while to locate WHERE exactly Coroutine is located. It was not in Styx -- it was in Buddy . Please try and let me know how it goes.


      RaFQuester.cs
      Code:
      /*
      +-----------------------------------------------------------------------------
      |   RaFQuester, RaFQuester/RaFQuester.cs
      |   ====================================
      |   Created By KinG modified by hackersrage
      |   Version 1.0.6a
      | 	Last updated 2014-06-18
      +-----------------------------------------------------------------------------
      */
      
      using System;
      using System.Collections.Generic;
      using System.Diagnostics;
      using System.IO;
      using System.Linq;
      using System.Runtime.InteropServices;
      using System.Text;
      using System.Threading;
      using System.Windows.Media;
      using Styx;
      using Styx.Common;
      using Styx.Common.Helpers;
      using Styx.CommonBot;
      using Styx.CommonBot.AreaManagement;
      using Styx.CommonBot.Database;
      using Styx.CommonBot.Frames;
      using Styx.CommonBot.Inventory;
      using Styx.CommonBot.Profiles;
      using Styx.CommonBot.POI;
      using Styx.CommonBot.Routines;
      using Styx.Helpers;
      using Styx.Pathing;
      using Styx.Plugins;
      using Styx.WoWInternals;
      using Styx.WoWInternals.Misc;
      using Styx.WoWInternals.World;
      using Styx.WoWInternals.WoWObjects;
      using Styx.TreeSharp;
      using Buddy.Coroutines;
      
      using Sequence = Styx.TreeSharp.Sequence;
      using Action = Styx.TreeSharp.Action;
      using CommonBehaviors.Actions;
      using Levelbot.Actions.Combat;
      
      
      namespace RaFQuester
      {
          public class Main : HBPlugin
          {
      
              public static LocalPlayer Me { get { return StyxWoW.Me; } }
              public static bool IsInGroup { get { return Me.GroupInfo.IsInParty; } }
      
              public uint partySize = 0;
              public int me_level = 0;
              public int resetTurnIn = 0;
              public long inRange = 0;
              public bool check_members_level = false;
              public Random rng = new Random();
      
      
              public WoWUnit lastQGtarget = null;
      
      
              public override string Name { get { return "RaF Quester"; } }
              public override string Author { get { return "KinG modified by hackersrage"; } }
              public override Version Version { get { return new Version(1, 0, 6); } }
              public override bool WantButton { get { return false; } }
      
              public override void Initialize()
              {
                  Logging.Write(Colors.SkyBlue, Name + " - Loaded Version " + Version + "a");
                  partySize = Me.GroupInfo.PartySize;
                  me_level = Me.Level;
                  Logging.Write(Colors.SkyBlue, Name + " - We are " + partySize.ToString() + " party members.");
              }
      
              public override void Pulse()
              {
                  try
                  {
                      if (!IsInGroup)
                      {
                          Logging.Write(Colors.Red, Name + " - I am not in a party, stopping the bot.");
                          TreeRoot.Stop(Name);
                      }
                      partyMemberLevelCheck();
                      TargetQGT();
      
                  }
                  catch (Exception ex)
                  {
                      Logging.WriteException(ex);
                  }
              }
      
              private async void TargetQGT()
              {
      
                  if (partySize != Me.GroupInfo.PartySize)
                  {
                      partySize = Me.GroupInfo.PartySize;
                      Logging.Write(Colors.SkyBlue, Name + " - We are " + partySize.ToString() + " party members.");
                  }
      
                  if (Me.CurrentTarget != null)
                  {
                      if (Me.CurrentTarget.QuestGiverStatus == QuestGiverStatus.TurnIn)
                      {
                          if (Me.CurrentTarget.WithinInteractRange)
                          {
                              WoWMovement.MoveStop();
                              if (partyMemberInRange())
                              {
                                  if (lastQGtarget != Me.CurrentTarget || Me.CurrentTarget == null)
                                  {
                                      Logging.Write(Colors.SkyBlue, Name + " - All members are within range.");
                                      Logging.Write(Colors.SkyBlue, Name + " - Waiting 8 seconds before turning in the quest.");
                                      inRange = 0;
                                      await Coroutine.Sleep(8000);
                                      //Will turn in quest here if all arguments are passed.
                                  }
      
                                  if (Me.CurrentTarget != null)
                                      lastQGtarget = Me.CurrentTarget;
                                  return;
                              }
                              else
                              {
                                  if (Styx.CommonBot.Frames.QuestFrame.Instance.IsVisible || Styx.CommonBot.Frames.GossipFrame.Instance.IsVisible) { Styx.CommonBot.Frames.QuestFrame.Instance.Close(); Styx.CommonBot.Frames.GossipFrame.Instance.Close(); }
                                  return;
                              }
                          }
                      }
                  }
      
                  if (lastQGtarget != null)
                  {
                      if (lastQGtarget.WithinInteractRange)
                      {
                          if (lastQGtarget.QuestGiverStatus == QuestGiverStatus.TurnIn)
                          {
                              lastQGtarget.Target();
                              TargetQGT();
                          }
                          if (lastQGtarget.QuestGiverStatus == QuestGiverStatus.Available || lastQGtarget.QuestGiverStatus == QuestGiverStatus.AvailableRepeatable || lastQGtarget.QuestGiverStatus == QuestGiverStatus.LowLevelAvailable || lastQGtarget.QuestGiverStatus == QuestGiverStatus.None)
                          {
      
                              int waitTime = rng.Next(5, 8);
                              Logging.Write(Colors.SkyBlue, Name + " - I am in a " + waitTime.ToString() + " seconds wait period.");
                              WoWMovement.MoveStop();
                              Me.ClearTarget();
                              await Coroutine.Sleep(waitTime * 1000);
      
                              if (Me.PartyMembers.Count(player => player != null && player.IsValid && player.CurrentTarget == lastQGtarget && lastQGtarget != null) > 0)
                              {
                                  Logging.Write(Colors.SkyBlue, Name + " - My other party member(s) is still turning in the quest(s), waiting again.");
                                  resetTurnIn++;
                                  if (resetTurnIn == 2)
                                  {
                                      Logging.Write(Colors.SkyBlue, Name + " - I've waited 2 times extra now, assuming we only were stuck in a loop.");
                                      resetTurnIn = 1;
                                      lastQGtarget = null;
                                      return;
                                  }
                                  TargetQGT();
                              }
                          }
                      }
                      lastQGtarget = null;
                  }
      
                  return;
              }
      
              private bool partyMemberInRange()
              {
      
                  if (!IsInGroup) return false;
      
                  int membersInRange = Me.PartyMembers.Count(player => player != null && Me.Location.Distance(player.Location) <= 10);
      
                  if (membersInRange == partySize && membersInRange != 0)
                  {
                      return true;
                  }
                  else
                  {
                      if (inRange != (partySize - membersInRange))
                      {
                          inRange = (partySize - membersInRange);
                          Logging.Write(Colors.SkyBlue, Name + " - " + (partySize - membersInRange).ToString() + " player(s) are out of range.");
                      }
                      return false;
                  }
              }
      
              private void partyMemberLevelCheck()
              {
      
                  //If we are under level 10 and we are different classes remove range check.
                  if (lastQGtarget == null)
                  {
                      // We don't want to reload the profile while we are turning in quests or waiting for other members.
                      if (Me.Level == (me_level + 1))
                      {
                          Logging.Write(Colors.SkyBlue, Name + " - I have leveled up! I am now level " + Me.Level + ", checking if my party members are the same level.");
                          me_level = Me.Level;
                          check_members_level = true;
                      }
      
                      if (check_members_level)
                      {
                          if (Me.PartyMembers.Count(player => player != null && player.IsValid && player.Level == Me.Level) == partySize && Me.Level >= 10)
                          {
                              Logging.Write(Colors.SkyBlue, Name + " - We are all the same level, reloading profile to see if we need to change area.");
                              ProfileManager.LoadNew(ProfileManager.XmlLocation, true);
                              check_members_level = false;
                          }
                      }
      
                  }
                  return;
              }
      
              /*private bool knownBadTurnIn(WoWUnit questGiver){
                  if(questGiver == "name")
              }*/
      
      
          }
      }
      
       
    18. razer

      razer New Member

      Joined:
      Apr 29, 2012
      Messages:
      1,347
      Likes Received:
      7
      Trophy Points:
      0
      I can see it now I had tried it with 2 accounts and still getting crashes. Thanks for trying :(
       
    19. hackersrage

      hackersrage Member Buddy Store Developer

      Joined:
      Nov 18, 2012
      Messages:
      342
      Likes Received:
      15
      Trophy Points:
      18
      @razer -- could you post the log. I can see what I can do to fix it. It should show where it's having an exception. I did implement the Coroutines rather lazy. Also, is it still crashing on Quest hand-in ?

      Cheers.
       
    20. hackersrage

      hackersrage Member Buddy Store Developer

      Joined:
      Nov 18, 2012
      Messages:
      342
      Likes Received:
      15
      Trophy Points:
      18
      >> To other coders <<

      I think another quick fix (which may cause some quests to not hand in at the same time -- hence the 30 second wait after), would be something like the following. I don't know all the HonorBuddy commands to do this, however the logical process would be something like the following :

      Pseudo code
      Code:
      If (QuestCompleted and AtTurnInPoint and !QuestTurnedIn) {
          DoWait = 0
          SafeHandIn = False
          If PartyLeader HasQuest AND QuestTurnedIn {
               DoWait = Me.PartyPosition * Random(1-4)
               SafeHandIn = True
          } else {
               DoWait = Random(5-10)
          }
          await Coroutine.Sleep(DoWait, Function(SafeHandIn) {
                                                            If SafeHandIn = True {
                                                                  HandInQuest()
                                                                                                                                          
                                                            }
                                                    }
                                        )
          await Coroutine.Sleep(30)
      }
      
       
      Last edited: Jun 19, 2014

    Share This Page