Beispiel #1
0
    public void Initialize()
    {
        if (!Products.ProductName.Equals("Quester") &&
            !Products.ProductName.Equals("Grinder") &&
            !Products.ProductName.Equals("Wholesome Professions WotLK"))
        {
            return;
        }

        isLaunched = true;

        isHorde = ToolBox.GetIsHorde();

        WFMSettings.Load();
        WFMDeepSettings.Load();

        if (AutoUpdater.CheckUpdate(version))
        {
            Logger.LogWarning("New version downloaded, restarting plugin, please wait");
            ToolBox.Restart();
            return;
        }

        Logger.Log($"Launching version {version} on client {ToolBox.GetWoWVersion()}");
        MovementManager.StopMoveNewThread();
        MovementManager.StopMoveToNewThread();

        FlightMasterDB.Initialize();
        WFMSetup.SetBlacklistedZonesAndOffMeshConnections();
        WFMSetup.DiscoverDefaultNodes();

        detectionPulse.DoWork += BackGroundPulse;
        detectionPulse.RunWorkerAsync();

        FiniteStateMachineEvents.OnRunState         += StateEventHandler;
        MovementEvents.OnMovementPulse              += MovementEventsOnMovementPulse;
        MovementEvents.OnSeemStuck                  += SeemStuckHandler;
        EventsLuaWithArgs.OnEventsLuaStringWithArgs += ToolBox.MessageHandler;

        EventsLua.AttachEventLua("TAXIMAP_OPENED", (e) => isFMMapOpen = true);
        EventsLua.AttachEventLua("TAXIMAP_CLOSED", (e) => isFMMapOpen = false);
        EventsLua.AttachEventLua("GOSSIP_SHOW", (e) => isGossipOpen   = true);
        EventsLua.AttachEventLua("GOSSIP_CLOSED", (e) => isGossipOpen = false);
    }
 public static bool Load()
 {
     try
     {
         if (File.Exists(AdviserFilePathAndName("WFMDeepSettings",
                                                ObjectManager.Me.Name + "." + Usefuls.RealmName)))
         {
             CurrentSettings = Load <WFMDeepSettings>(
                 AdviserFilePathAndName("WFMDeepSettings",
                                        ObjectManager.Me.Name + "." + Usefuls.RealmName));
             return(true);
         }
         CurrentSettings = new WFMDeepSettings();
     }
     catch (Exception e)
     {
         Logger.LogError("WFMDeepSettings > Load(): " + e);
     }
     return(false);
 }