private void InitBot(GlobalSettings settings, string profileName = "Unknown") { try { var newBot = CreateBowWindowData(settings, profileName); var session = new Session(newBot.Settings, newBot.Logic); session.Client.ApiFailure = new ApiFailureStrategy(session); newBot.GlobalSettings.MapzenAPI.SetSession(session); newBot.Session = session; session.EventDispatcher.EventReceived += evt => newBot.Listener.Listen(evt, session); session.EventDispatcher.EventReceived += evt => newBot.Aggregator.Listen(evt, session); session.Navigation.UpdatePositionEvent += (lat, lng, alt) => session.EventDispatcher.Send(new UpdatePositionEvent { Latitude = lat, Longitude = lng, Altitude = alt }); newBot.PokemonList.CollectionChanged += delegate { UpdatePokemonCollection(session); }; newBot.Stats.DirtyEvent += () => { StatsOnDirtyEvent(newBot); }; newBot._lat = settings.LocationSettings.DefaultLatitude; newBot._lng = settings.LocationSettings.DefaultLongitude; newBot.Machine.SetFailureState(new LoginState()); GlobalMapView.addMarker(newBot.GlobalPlayerMarker); BotsCollection.Add(newBot); } catch (Exception ex) { MessageBox.Show("Initializing of new bot failed! ex:\r\n" + ex.Message, "FatalError", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void InitBot(GlobalSettings settings, string profileName = "Unknown") { try { var newBot = CreateBowWindowData(settings, profileName); var session = new Session(newBot.Settings, newBot.Logic); session.Client.ApiFailure = new ApiFailureStrategy(session); newBot.GlobalSettings.MapzenAPI.SetSession(session); newBot.Session = session; session.EventDispatcher.EventReceived += evt => _listener.Listen(evt, session); session.EventDispatcher.EventReceived += evt => _statisticsAggregator.Listen(evt, session); session.Navigation.UpdatePositionEvent += (lat, lng, alt) => session.EventDispatcher.Send(new UpdatePositionEvent { Latitude = lat, Longitude = lng, Altitude = alt }); newBot.PokemonList.CollectionChanged += delegate { UpdatePokemonCollection(session); }; newBot.ItemList.CollectionChanged += delegate { UpdateItemCollection(session); }; session.Stats.DirtyEvent += () => { StatsOnDirtyEvent(newBot); }; newBot._lat = settings.LocationSettings.DefaultLatitude; newBot._lng = settings.LocationSettings.DefaultLongitude; newBot.Machine.SetFailureState(new LoginState()); GlobalMapView.addMarker(newBot.GlobalPlayerMarker); if (newBot.Logic.UseCustomRoute) { if (!IsNullOrEmpty(newBot.GlobalSettings.LocationSettings.CustomRouteName)) { var route = GlobalCatchemSettings.Routes.FirstOrDefault( x => string.Equals(x.Name, newBot.GlobalSettings.LocationSettings.CustomRouteName, StringComparison.CurrentCultureIgnoreCase)); if (route != null) { newBot.GlobalSettings.LocationSettings.CustomRoute = route.Route; } } } else if (!IsNullOrEmpty(newBot.GlobalSettings.LocationSettings.CustomRouteName)) { newBot.GlobalSettings.LocationSettings.CustomRouteName = ""; } #if DEBUG SeedTheBot(newBot); #endif BotsCollection.Add(newBot); if (newBot.GlobalSettings.AutoStartThisProfile) { newBot.Start(); } } catch (Exception ex) { MessageBox.Show("Initializing of new bot failed! ex:\r\n" + ex.Message, "FatalError", MessageBoxButton.OK, MessageBoxImage.Error); } }
public static bool TeleportToGlobalMapPoint(BlueprintGlobalMapPoint destination) { if (GlobalMapView.Instance != null) { var globalMapController = Game.Instance.GlobalMapController; GlobalMapUI globalMapUI = Game.Instance.UI.GlobalMapUI; GlobalMapView globalMapView = GlobalMapView.Instance; GlobalMapState globalMapState = Game.Instance.Player.GetGlobalMap(destination.GlobalMap); GlobalMapPointState pointState = Game.Instance.Player.GetGlobalMap(destination.GlobalMap).GetPointState(destination); pointState.EdgesOpened = true; pointState.Reveal(); GlobalMapPointView pointView = globalMapView.GetPointView(destination); if ((bool)(UnityEngine.Object)globalMapView) { if ((bool)(UnityEngine.Object)pointView) { globalMapView.RevealLocation(pointView); } } foreach (var edge in pointState.Edges) { edge.UpdateExplored(1f, 1); globalMapView.GetEdgeView(edge.Blueprint).UpdateRenderers(); } globalMapController.StartTravels(); EventBus.RaiseEvent <IGlobalMapPlayerTravelHandler>((Action <IGlobalMapPlayerTravelHandler>)(h => h.HandleGlobalMapPlayerTravelStarted((IGlobalMapTraveler)globalMapView.State.Player))); globalMapView.State.Player.SetCurrentPosition(new GlobalMapPosition(destination)); globalMapView.GetPointView(destination)?.OpenOutgoingEdges((GlobalMapPointView)null); globalMapView.UpdatePawnPosition(); globalMapController.Stop(); EventBus.RaiseEvent <IGlobalMapPlayerTravelHandler>((Action <IGlobalMapPlayerTravelHandler>)(h => h.HandleGlobalMapPlayerTravelStopped((IGlobalMapTraveler)globalMapView.State.Player))); globalMapView.PlayerPawn.m_Compass.TryClear(); globalMapView.PlayerPawn.m_Compass.TrySet(); #if false globalMapView.TeleportParty(globalMapPoint); globalMapUI.HandleGlobalMapPlayerTravelStopped(globalMapState.Player); GlobalMapPointState pointState = Game.Instance.Player.GlobalMap.GetPointState(globalMapPoint); pointState.EdgesOpened = true; pointState.Reveal(); GlobalMapPointView pointView = globalMapView.GetPointView(globalMapPoint); pointView?.OpenOutgoingEdges((GlobalMapPointView)null); globalMapView.RevealLocation(pointView); if ((bool)(UnityEngine.Object)globalMapView) { if ((bool)(UnityEngine.Object)pointView) { globalMapView.RevealLocation(pointView); } } globalMapView.UpdatePawnPosition(); pointState.LastVisited = Game.Instance.TimeController.GameTime; #endif return(true); } return(false); }
public static void Prefix( GlobalMapState state, GlobalMapView view, IGlobalMapTraveler traveler, ref float visualStepDistance) { // TODO - can we get rid of the other map movement multipliers and do them all here? if (traveler is GlobalMapArmyState armyState && armyState.Data.Faction == ArmyFaction.Crusaders) { var speedMultiplier = Mathf.Clamp(settings.travelSpeedMultiplier, 0.1f, 100f); visualStepDistance = speedMultiplier * visualStepDistance; } }
private void ChangeTransistor() { if (grid_pickBot.Visibility == Visibility.Visible) { return; } if (transit.SelectedIndex == 0) { GlobalMapView.FitTheStuff(); transit.SelectedIndex = 1; changeViewSettingsMap.Content = "Settings"; } else { transit.SelectedIndex = 0; changeViewSettingsMap.Content = "World Map"; } }
public MainWindow() { InitializeComponent(); //global settings GlobalCatchemSettings.Load(); InitWindowsControlls(); BotWindow = this; LogWorker(); RpcWorker(); InitBots(); SettingsView.BotMapPage.SetSettingsPage(SettingsView.BotSettingsPage); SetVersionTag(); SettingsView.BotMapPage.SetGlobalSettings(GlobalCatchemSettings); GlobalMapView.SetGlobalSettings(GlobalCatchemSettings); SettingsView.BotSettingsPage.SetGlobalSettings(GlobalCatchemSettings); RouteCreatorView.SetGlobalSettings(GlobalCatchemSettings); }
private void btn_changeViewSettingsMap_Click(object sender, RoutedEventArgs e) { GlobalMapView.FitTheStuff(); ChangeTransistorTo(1); }