public static SubProfile GetAppropriateSubProfile(HBProfile profile) { SubProfile sub = null; var myLevel = Manager.LocalPlayer.Level; foreach (var s in profile.SubProfile) { if (s.MinLevel <= myLevel && s.MaxLevel >= myLevel) { sub = s; } } return(sub); }
private bool SetupProfile() { try { if (Profile == null) return false; //SubProfile = ProfileHelper.GetAppropriateSubProfile(Profile); var myLevel = Manager.LocalPlayer.Level; foreach (var s in Profile.SubProfile) { if (s.MinLevel <= myLevel && s.MaxLevel >= myLevel) SubProfile = s; } // Profile doesnt contain anything for our level? if (SubProfile == null) return false; if (Hotspots == null) Hotspots = new List<Location>(); Hotspots.Clear(); for (int i = 0; i < SubProfile.GrindArea[0].Hotspots.Count(); i++) { var hotspot = SubProfile.GrindArea[0].Hotspots[i]; Hotspots.Add(hotspot.Location); } //Print("Loaded subprofile {0} (Level range: {1}-{2}) with {3} hotspots", SubProfile.Name, SubProfile.MinLevel, // SubProfile.MaxLevel, Hotspots.Count); var states = new List<State> { new GBReleaseCorpse(this), new GBCorpseRun(this), new GBRetrieveCorpse(this), new GBCombat(this), new GBGoto(this), new GBLoot(this), new GBPull(this), new GBPatrol(this) }; FSM.LoadStates(states); //Print("Loaded {0} states", states.Count); } catch (Exception) { Print("This profile is a mess, fix it or get a new one!"); return false; } return true; }