public static bool Convert(string path) { try { FisherbotProfile flyingProfile = XmlSerializer.Deserialize <FisherbotProfile>(path); string flyingProfileName = Path.GetFileNameWithoutExtension(path); if (flyingProfile.Points.Count <= 0) { Logging.Write(string.Format("The file {0} is not a valid Fisherbot Profile.", flyingProfileName)); return(false); } if (flyingProfile.Points.Any(p => p.Type.ToLower() == "flying")) { MovementManager.FlyingToGroundProfilesConverter(flyingProfile.Points, out _points, out _result); } else { Logging.Write(string.Format("The profile {0} is not a Flying Fisherbot Profile.", flyingProfileName)); return(false); } if (!_result) { return(false); } flyingProfile.Points = _points; string pathDir = Application.StartupPath + "\\Profiles\\Fisherbot\\"; string fullPath = pathDir + "Ground_" + flyingProfileName + ".xml"; if (XmlSerializer.Serialize(fullPath, flyingProfile)) { Logging.Write(string.Format("The Flying profile {0} have been saved.", flyingProfileName)); Logging.Write("Path: " + fullPath); return(true); } Logging.Write(string.Format("The Flying profile {0} have not been saved correctly, make sure you have access right on the directory {1}.", flyingProfileName, pathDir)); return(false); } catch { Logging.Write("Conversion Failled (WowRobot to Fisherbot bot): " + path); return(false); } }
internal static bool Pulse() { try { Profile = new FisherbotProfile(); // If Fish School Load Profile if (FisherbotSetting.CurrentSetting.FishSchool) { if (File.Exists(Application.StartupPath + "\\Profiles\\Fisherbot\\" + FisherbotSetting.CurrentSetting.FishSchoolProfil)) { Profile = XmlSerializer.Deserialize <FisherbotProfile>(Application.StartupPath + "\\Profiles\\Fisherbot\\" + FisherbotSetting.CurrentSetting.FishSchoolProfil); if (Profile.Points.Count <= 0) { return(false); } } else { MessageBox.Show(nManager.Translate.Get(nManager.Translate.Id.Please_select_an_profile_or_disable_School_Fish_option)); return(false); } } // Black List: nManagerSetting.AddRangeBlackListZone(new List <nManagerSetting.BlackListZone>(Profile.BlackListRadius)); // Load CC: CombatClass.LoadCombatClass(); if (!FisherbotSetting.CurrentSetting.FishSchool) { FisherbotSetting.CurrentSetting.FisherbotPosition = ObjectManager.Me.Position; FisherbotSetting.CurrentSetting.FisherbotRotation = ObjectManager.Me.Rotation; } // FSM Fsm.States.Clear(); Fsm.AddState(new Pause { Priority = 200 }); Fsm.AddState(new Resurrect { Priority = 140 }); Fsm.AddState(new IsAttacked { Priority = 130 }); Fsm.AddState(new ToTown { Priority = 120 }); Fsm.AddState(new Looting { Priority = 110 }); Fsm.AddState(new Travel { Priority = 100 }); Fsm.AddState(new Regeneration { Priority = 90 }); Fsm.AddState(new SpecializationCheck { Priority = 80 }); Fsm.AddState(new LevelupCheck { Priority = 70 }); Fsm.AddState(new Trainers { Priority = 60 }); Fsm.AddState(new AutoItemCombiner { Priority = 52 }); Fsm.AddState(new MillingState { Priority = 51 }); Fsm.AddState(new ProspectingState { Priority = 50 }); Fsm.AddState(new Farming { Priority = 30 }); Fsm.AddState(new FisherbotState { Priority = 20 }); Fsm.AddState(new MovementLoop { Priority = 10, PathLoop = Profile.Points }); Fsm.AddState(new Idle { Priority = 0 }); foreach (var statePlugin in Plugins.ListLoadedStatePlugins) { Fsm.AddState(statePlugin); } Fsm.States.Sort(); Fsm.StartEngine(7, "FSM Fisherbot"); return(true); } catch (Exception e) { try { Dispose(); } catch { } Logging.WriteError("Fisherbot > Bot > Bot > Pulse(): " + e); return(false); } }