Beispiel #1
0
 internal static void g__CHAT_MSG_PET_INFO()
 {
     if (FNVFlightMasterSettings.CurrentSettings.updateTaxi && !Main._updateNodes)
     {
         Main._updateNodes = true;
         foreach (FlightMasterDB flightMasterDB in Main.fillDB())
         {
             if (flightMasterDB.continent.Equals(Main.checkContinent()))
             {
                 int num = Lua.LuaDoString <int>("for i=0,48 do if string.find(TaxiNodeName(i),\'" + to.name.Replace("'", "\\'") + "\') then return i end end return -1", "");
                 if (num == -1 && flightMasterDB.alreadyDiscovered)
                 {
                     Logging.Write("[tbcFlightMaster]: Taxi node " + flightMasterDB.name + " has not been discovered so far");
                     flightMasterDB.alreadyDiscovered = false;
                     FNVFlightMasterSettings.flightMasterSaveChanges(flightMasterDB, false);
                 }
                 else if (num != -1 && !flightMasterDB.alreadyDiscovered)
                 {
                     Logging.Write("[tbcFlightMaster]: Taxi node " + flightMasterDB.name + " has already been discovered");
                     flightMasterDB.alreadyDiscovered = true;
                     FNVFlightMasterSettings.flightMasterSaveChanges(flightMasterDB, true);
                 }
             }
         }
         Main._updateNodes = false;
         Thread.Sleep(Usefuls.Latency * 5 + 5000);
     }
 }
    private static void discoverTaxi(FlightMasterDB flightMasterToDiscover)
    {
        FNVFlightMasterSettings.Load();
        List <FlightMasterDB> FMLdt = fillDB();

        if (wManager.Wow.Bot.Tasks.GoToTask.ToPosition(flightMasterToDiscover.position, 3.5f, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore))
        {
            wManager.Wow.Bot.Tasks.GoToTask.ToPosition(flightMasterToDiscover.position, 3.5f, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore);

            if (wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(flightMasterToDiscover.position, flightMasterToDiscover.NPCId, -1, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false))
            {
                wManager.wManagerSetting.ClearBlacklistOfCurrentProductSession();
                wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(flightMasterToDiscover.position, flightMasterToDiscover.NPCId, -1, false, context => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore, false);

                if (ObjectManager.Me.IsMounted)
                {
                    wManager.Wow.Bot.Tasks.MountTask.DismountMount(false, false, 100);
                }

                Usefuls.SelectGossipOption(GossipOptionsType.taxi);
                Thread.Sleep(Usefuls.Latency + 1500);

                while (_updateNodes)
                {
                    Logging.Write("[VanillaFLightMaster]: Taxi node update in progress...");
                    Thread.Sleep(10000);
                }

                Logging.Write("[VanillaFlightMaster]: Flight Master " + flightMasterToDiscover.name + " discovered");
                flightMasterToDiscover.alreadyDiscovered = true;
                FNVFlightMasterSettings.flightMasterSaveChanges(flightMasterToDiscover, true);

                Thread.Sleep(Usefuls.Latency * 5);

                timer = 0;
                //_timer = true;
                discoverTaxiNode     = (FlightMasterDB)null;
                _taxiToDiscover      = false;
                _discoverInProessing = false;
                _discoverTaxiTimer   = true;
                Reenable();
                return;
            }
        }
        _discoverInProessing = false;
        return;
    }
    private void watchForEvents()
    {
        EventsLuaWithArgs.OnEventsLuaWithArgs += (LuaEventsId id, List <string> args) =>
        {
            if (id == wManager.Wow.Enums.LuaEventsId.TAXIMAP_OPENED && FNVFlightMasterSettings.CurrentSettings.updateTaxi)
            {
                if (!_updateNodes)
                {
                    _updateNodes = true;
                    List <FlightMasterDB> dbUpdate = fillDB();
                    int node = -1;

                    foreach (var temp in dbUpdate)
                    {
                        if (temp.continent.Equals(checkContinent()))
                        {
                            node = -1;
                            node = wManager.Wow.Helpers.Lua.LuaDoString <int>("for i=0,30 do if string.find(TaxiNodeName(i),'" + temp.name + "') then return i end end return -1");

                            if (node == -1 && temp.alreadyDiscovered)
                            {
                                Logging.Write("[VanillaFlightMaster]: Taxi node " + temp.name + " has not been discovered so far");
                                temp.alreadyDiscovered = false;
                                FNVFlightMasterSettings.flightMasterSaveChanges(temp, false);
                            }
                            else if (node != -1 && !temp.alreadyDiscovered)
                            {
                                Logging.Write("[VanillaFlightMaster]: Taxi node " + temp.name + " has already been discovered");
                                temp.alreadyDiscovered = true;
                                FNVFlightMasterSettings.flightMasterSaveChanges(temp, true);
                            }
                        }
                    }
                    _updateNodes = false;
                    Thread.Sleep(Usefuls.Latency * 5 + 5000);
                }
            }
        };
    }