Jump to content

Quester settings saving


Enraged
 Share

Recommended Posts

Hey gents,

Has anyone had luck with updating "Quester.Bot.QuesterSetting.CurrentSetting.SaveModifiedGeneralSettings" or "Quester.Bot.QuesterSetting.CurrentSetting.SkipPickUpQuestAfterXSecondes"?

I have attempted a few different ways to update this, but the calls do not seem to be doing anything.

I also have attempted to call "Quester.Bot.QuesterSetting.CurrentSetting.Save();" in hopes that maybe that just needed to be invoked for it to write to the XML file.

Been bashing my head against the desk about this one, hoping that I am just missing something simple, don't want to have to revert to manually writing to the XML directly.

Thanks in advanced,

-Enraged

Link to comment
Share on other sites

Hello,

        var assembly = System.AppDomain.CurrentDomain.GetAssemblies().LastOrDefault(a => a.FullName.Contains("Quester"));
        if (assembly !=null)
        {
            try
            {
                var currentSetting = assembly.GetType("Quester.Bot.QuesterSetting").GetProperty("CurrentSetting").GetValue(null, null) as Quester.Bot.QuesterSetting;
                if (currentSetting != null)
                {
                    currentSetting.SaveModifiedGeneralSettings = true;
                    currentSetting.ProfileName = "test.xml";
                    robotManager.Helpful.Logging.Write("OK");
                }
            } catch { }
        }

 

Link to comment
Share on other sites

So it looks like it is finding the assembly, but it doesn't seem to be getting past the GetType

assembly.GetType("Quester.Bot.QuesterSetting")

I used to catch

assembly.GetType("Quester.Bot.QuesterSetting", true)

and get


System.TypeLoadException: Could not load type 'Quester.Bot.QuesterSetting' from assembly 'QuesterPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
   at QuesterPlugin.UpdateSettings.SaveUpdateSettings()
 

Am I missing something? 

Thanks again,

-Enraged

Link to comment
Share on other sites

This isn't much of an issue honestly if it is just a UI not updating, because the settings and profile is changing as expected.

My bigger issue is that I am accessing

Quest.QuesterCurrentContext.QuestsClasses;

to get .Values so I can populate my Quest list to be able to check/uncheck.

Although because of this UI not changing, the QuestClasses do not seem to update either until 

robotManager.Products.Products.ProductRestart();

happens.

So for a workaround I am using

robotManager.Products.Products.ProductRestart();
robotManager.Products.Products.ProductStop();

To quickly update the list, which I can then use to select Quest Values options...

This feels like bad practise, and I think I must be doing something wrong for this to not update until Product Restart.

From what I saw in the Quester dll, it seems that the methods that would make this simpler are protected.

I used my own file checking as you did to populate the profile list

public static string ProfilePathFolder { get { return Application.StartupPath + @"\Profiles\Quester\"; } }
        public void getProfiles()
        {
            FullProfileList.Clear();
            foreach (string file in Directory.EnumerateFiles(ProfilePathFolder, "*.xml"))
            {
                if (File.Exists(file) && File.ReadAllText(file).Contains("</EasyQuestProfile>"))
                {
                    FullProfileList.Add(Path.GetFileName(file));
                }
            }
        }

 should I just be Deserializing the XML file myself as well to build the 

Quest.QuesterCurrentContext.QuestsClasses.Values

?image.thumb.png.c568f0275d51ced96cb555c36df9f54a.png

 

Thank you for continued support,

- Enraged

Link to comment
Share on other sites

I am not sure what you mean, this is a plugin I am going to release once I get the final detail finished. Going to release it likely as a standalone, as well as restricted item with Arcangelo's questing profiles.

Link to comment
Share on other sites

8 minutes ago, Mike-Mail said:

Can i get a copy of the beta test it and give you some help?

Let me finish this bit of the Quest Skip option handling, rename a few things and clean it up, then I will let ya try it out. Its fully functional right now, but I do not like having to call the bot to start and stop to update the quest list.

That, and hopefully with Droidz help I can figure out why my plugin is updating instantly and running with correct settings, but the built in quester is not recognizing the Save.

(Maybe I just need to call a load)

I will get back to you shortly @Mike-Mail

Link to comment
Share on other sites

On 3/18/2018 at 9:17 AM, Droidz said:

Hello,

        var assembly = System.AppDomain.CurrentDomain.GetAssemblies().LastOrDefault(a => a.FullName.Contains("Quester"));
        if (assembly !=null)
        {
            try
            {
                var currentSetting = assembly.GetType("Quester.Bot.QuesterSetting").GetProperty("CurrentSetting").GetValue(null, null) as Quester.Bot.QuesterSetting;
                if (currentSetting != null)
                {
                    currentSetting.SaveModifiedGeneralSettings = true;
                    currentSetting.ProfileName = "test.xml";
                    robotManager.Helpful.Logging.Write("OK");
                }
            } catch { }
        }

 

@Droidz I found the problem of why this wasn't producing a value.. because my plugin has quester in the name obviously, and its the last thing running so

"Contains("Quester")" 

was pointing to my plugin. So I changed it to

a.FullName.StartsWith("Quester");

I am getting "OK" output now, and in my plugin I am seeing the current selected  profile update to the “test.xml”, and starting the bot does attempt to run that profile. Still, upon navigating to the built in quester, there is no change.

====================================

Okay, so I think I figured out what is causing this...

I think you have the Quester/Product settings screen memory in two different places? Or you are overriding elsewhere by mistake?

Clearly I am updating the Quester settings, and the XML and questersetting currentsetting is reflecting that change.

Yet when any interaction occurs with the quester/product screen, click to or click away, it resets back to previous setting, and save those settings in XML.

This is what the test button am clicking in the video is

Logging.WriteDebug($"Save Modified?: { Quester.Bot.QuesterSetting.CurrentSetting.SaveModifiedGeneralSettings}");
Logging.WriteDebug($"Skip Pickup Time: { Quester.Bot.QuesterSetting.CurrentSetting.SkipPickUpQuestAfterXSecondes}");

 

Please take a look at this brief video for an example

2018-03-19 22-30-44.mp4

 

Thank you for your support,

-Enraged

Edited by Enraged
Add new information
Link to comment
Share on other sites

Try to run this code (after change settings)

        var pName = robotManager.Products.Products.ProductName;
        robotManager.Products.Products.DisposeProduct();
        robotManager.Products.Products.LoadProducts(pName);

 

Link to comment
Share on other sites

On 3/23/2018 at 9:15 AM, Droidz said:

Try to run this code (after change settings)

        var pName = robotManager.Products.Products.ProductName;
        robotManager.Products.Products.DisposeProduct();
        robotManager.Products.Products.LoadProducts(pName);

 

I've tried everything I could think of. The only time the settings remain correct is when you save changes, then immediately shut down wrobot.

When it starts up again it reads from XML, which has the correct settings.

Link to comment
Share on other sites

Ok, else you can also create wrapper product (to get full access to "quester" product and override product settings tab) (create your own product and load yourself Quester)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...