private void Flush(bool all = false)
        {
            passwordOfst   = 0;
            roomNameOfst   = 0;
            artistNameOfst = 0;
            hotspotOfst    = 0;
            pictureOfst    = 0;
            firstLProp     = 0;
            firstDrawCmd   = 0;
            nbrDrawCmds    = 0;
            nbrHotspots    = 0;
            nbrLProps      = 0;
            nbrPictures    = 0;
            base.Clear();

            if (all)
            {
                ID       = 0;
                Name     = null;
                Artist   = null;
                Password = null;
                LooseProps.Clear();
                Pictures.Clear();
                DrawCommands.Clear();
                Hotspots.Clear();
            }
        }
Example #2
0
 public void Update(double average, int total, int hotspots, double distribution)
 {
     Average.Update(average); Changed(() => Average);
     Total.Update(total); Changed(() => Total);
     Hotspots.Update(hotspots); Changed(() => Hotspots);
     Distribution.Update(distribution); Changed(() => Distribution);
 }
Example #3
0
        protected sealed override void OnTagStart()
        {
            FlightCheck();
            GetQuestData();
            SetupConditional();

            if (Hotspots.Count == 0)
            {
                if (XYZ == Vector3.Zero)
                {
                    LogError("No hotspots and no XYZ provided, this is an invalid combination for this behavior");
                    return;
                }
                Hotspots.Add(new HotSpot(XYZ, Radius));
            }

            Hotspots.IsCyclic = true;
            Hotspots.Index    = 0;

            if (ItemTarget != 0 && LacksAuraId > 0)
            {
                TreeHooks.Instance.AddHook("Combat", new ActionRunCoroutine(cr => UseItem()));
            }

            OnHuntStart();
        }
Example #4
0
        protected sealed override async Task Main()
        {
            if (!IsDone)
            {
                await CommonTasks.HandleLoading();

                await GoThere();

                if (Target != null && !Blacklist.Contains(Target.ObjectId))
                {
                    await CustomLogic();
                }
                else
                {
                    if (ItemTarget != 0)
                    {
                        await UseItem();
                    }

                    if (!Position.WithinHotSpot2D(Me.Location, 5f))
                    {
                        await MoveAndStop(Position, Distance, "Searching for a Target for " + QuestName);
                    }

                    if (Hotspots.Count != 0 && Position.WithinHotSpot2D(Me.Location, 5f))
                    {
                        Hotspots.Next();
                    }
                }

                await Coroutine.Yield();
            }
        }
Example #5
0
        protected sealed override async Task <bool> Main()
        {
            await CommonTasks.HandleLoading();

            if (Target != null && await CustomLogic())
            {
                return(true);
            }

            if (ItemTarget != 0 && await UseItem())
            {
                return(true);
            }

            if (!Position.WithinHotSpot2D(Core.Player.Location, Distance * Distance) &&
                await MoveAndStop(Position, Distance, "Moving to HotSpot", true, (ushort)MapId, MountDistance))
            {
                return(true);
            }

            if (Hotspots.Count != 0 && Position.WithinHotSpot2D(Core.Player.Location, Radius))
            {
                Hotspots.Next();
            }

            return(false);
        }
 private void PrepareHotspots()
 {
     ClassSizeHotspots = Hotspots.OfClassSize().ToList();
     CumulativeComponentDependencyHotspots = Hotspots.OfCumulativeComponentDependency().ToList();
     CyclomaticComplexityHotspots          = Hotspots.OfCyclomaticComplexity().ToList();
     MethodLengthHotspots = Hotspots.OfMethodLength().ToList();
     NumberOfNonStaticPublicFieldsHotspots = Hotspots.OfNumberOfNonStaticPublicFields().ToList();
     NumberOfNamespacesInCycleHotspots     = Hotspots.OfNamespacesInCycle().ToList();
 }
Example #7
0
 void NewProfile_Click(object sender, System.EventArgs e)
 {
     Hotspots.Clear();
     HotspotsListBox.Items.Clear();
     VendorHotspots.Clear();
     VendorHotspotsListBox.Items.Clear();
     VendorName           = string.Empty;
     VendorNameInput.Text = string.Empty;
 }
Example #8
0
 protected override Composite CreateBehavior()
 {
     return
         (new PrioritySelector(ctx => Target,
                               CustomLogic,
                               new Decorator(ret => Hotspots.Count != 0 && Navigator.InPosition(Position, Core.Me.Location, 5f),
                                             new Action(ret => Hotspots.Next())
                                             ),
                               CommonBehaviors.MoveAndStop(ret => Position, 3f, true)
                               ));
 }
Example #9
0
        public async Task <bool> Main()
        {
            foreach (var o in Hotspots.OrderBy(r => r.Position.DistanceSqr(Core.Me.Location)))
            {
                if (IsDone)
                {
                    break;
                }

                if (!await Common.AwaitCombat())
                {
                    return(false);
                }

                if (!InCombat && !await Movement.MoveTo(o.Position, ignoreIndoors: IgnoreIndoors))
                {
                    return(false);
                }

                if (InCombat && !await Movement.MoveTo(o.Position, true, false, IgnoreIndoors))
                {
                    return(false);
                }

                if (!Common.Exists(o.Position, NpcIds))
                {
                    await Common.Sleep(500);

                    continue;
                }

                var obj = Common.GetClosest(NpcIds);

                if (!await Movement.MoveTo(obj.Location, true, true, IgnoreIndoors))
                {
                    return(false);
                }

                if (!await Common.UseItem(ItemId, obj, BlacklistAfter, BlacklistDuration))
                {
                    return(false);
                }

                await Common.Sleep(500);

                await Dialog.Skip();

                await Common.Sleep(Wait);
            }

            return(true);
        }
Example #10
0
 private void CreateHotSpot()
 {
     if (Hotspots.Count == 0)
     {
         Hotspots.Add(new HotSpot(XYZ, Radius));
         Hotspots.IsCyclic = true;
         Hotspots.Index    = 0;
         NeoProfileManager.UpdateCurrentProfileBehavior();
     }
     else
     {
         return;
     }
 }
Example #11
0
        void DeleteSelectedHotspot()
        {
            var index = HotspotsListBox.SelectedIndex;

            if (index > -1)
            {
                Hotspots.RemoveAt(HotspotsListBox.SelectedIndex);
                HotspotsListBox.Items.RemoveAt(HotspotsListBox.SelectedIndex);

                if (index != 0)
                {
                    HotspotsListBox.SelectedIndex = index - 1;
                }
            }
        }
Example #12
0
        protected override void OnStart()
        {
            SetupConditional();

            if (Hotspots != null)
            {
                if (Hotspots.Count == 0)
                {
                    if (XYZ == Vector3.Zero)
                    {
                        LogError("No hotspots and no XYZ provided, this is an invalid combination for this behavior.");
                        return;
                    }

                    Hotspots.Add(new HotSpot(XYZ, Radius));
                }

                Hotspots.IsCyclic = true;
                Hotspots.Index    = 0;
            }
        }
Example #13
0
        protected sealed override void OnStart()
        {
            SetupConditional();

            if (Hotspots.Count == 0)
            {
                if (XYZ == Vector3.Zero)
                {
                    LogError("No HotSpots, NpcIds or XYZ are provided, this is an invalid combination for this behavior.");
                    return;
                }

                Hotspots.Add(new HotSpot(XYZ, 50f));
            }

            if (InCombat)
            {
                _combatlogic = new ActionRunCoroutine(cr => Common.UseItem(ItemId, Poi.Current?.BattleCharacter, inCombat: true, hasAnyAura: Auras));
                TreeHooks.Instance.InsertHook("PreCombatLogic", 0, _combatlogic);
            }
        }
        protected virtual GameObject GetObject()
        {
            var possible = GameObjectManager.GetObjectsOfType <GameObject>(true, false).Where(obj => obj.IsVisible && obj.IsTargetable && NpcIds.Contains((int)obj.NpcId)).OrderBy(obj => obj.DistanceSqr(Core.Me.Location));

            float closest = float.MaxValue;

            foreach (var obj in possible)
            {
                if (obj.DistanceSqr() < 1)
                {
                    return(obj);
                }

                HotSpot target = null;
                foreach (var hotspot in Hotspots)
                {
                    if (hotspot.WithinHotSpot2D(obj.Location))
                    {
                        var dist = hotspot.Position.DistanceSqr(obj.Location);
                        if (dist < closest)
                        {
                            closest = dist;
                            target  = hotspot;
                        }
                    }
                }

                if (target != null)
                {
                    while (Hotspots.Current != target)
                    {
                        Hotspots.Next();
                    }

                    return(obj);
                }
            }

            return(null);
        }
Example #15
0
        private void CreateGrindArea()
        {
            if (Hotspots.Count == 0)
            {
                Hotspots.Add(new HotSpot(XYZ, Radius));
                Hotspots.IsCyclic = false;
                Hotspots.Index    = 0;
            }

            var grindArea = new GrindArea()
            {
                TargetMobs = NpcIds.Select(r => new TargetMob()
                {
                    Id = r
                }).ToList(),
                Hotspots = Hotspots.ToList(),
                Name     = QuestName
            };

            NeoProfileManager.CurrentGrindArea = grindArea;
            NeoProfileManager.UpdateGrindArea();
        }
Example #16
0
        void LoadProfile_Click(object sender, System.EventArgs e)
        {
            var ofd = new OpenFileDialog
            {
                Filter = "JSON files (*.json)|*.json"
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                using (var sw = new StreamReader(ofd.FileName))
                {
                    var username = sw.ReadLine();
                    var json     = Cryptography.DecryptStringAES(sw.ReadToEnd(), UserProfile.Id);
                    var profile  = JsonConvert.DeserializeObject <ProfileModel>(json);

                    Hotspots.Clear();
                    HotspotsListBox.Items.Clear();
                    foreach (var hotspot in profile.Hotspots)
                    {
                        var location = new Location(hotspot.X, hotspot.Y, hotspot.Z);
                        Hotspots.Add(location);
                        HotspotsListBox.Items.Add(location);
                        HotspotsListBox.SelectedIndex = HotspotsListBox.Items.Count - 1;
                    }
                    VendorHotspots.Clear();
                    VendorHotspotsListBox.Items.Clear();
                    foreach (var vendorHotspot in profile.VendorHotspots)
                    {
                        var location = new Location(vendorHotspot.X, vendorHotspot.Y, vendorHotspot.Z);
                        VendorHotspots.Add(location);
                        VendorHotspotsListBox.Items.Add(location);
                        VendorHotspotsListBox.SelectedIndex = VendorHotspotsListBox.Items.Count - 1;
                    }
                    VendorName           = profile.VendorName;
                    VendorNameInput.Text = profile.VendorName;
                }
            }
        }
Example #17
0
 void InsertNewHotspot()
 {
     Hotspots.Add(ObjectManager.Instance.Player.Position);
     HotspotsListBox.Items.Add(Hotspots.LastOrDefault());
     HotspotsListBox.SelectedIndex = HotspotsListBox.Items.Count - 1;
 }
Example #18
0
 void OnEnable()
 {
     allowRender = true;
     hotspots    = gameObject.GetComponent <Hotspots>();
     HeatmapViewModel.CurrentHeatpointsUpdated += RenderHeatmap;
 }