Exemplo n.º 1
0
        private void DrawObjectSymbol(ClassifiedObject CObj)
        {
            SpawnObject o = CObj.obj;

            //if (c > MAX_NUMBER) break;

            if (UseSimpleDots)
            {
                DrawDot(o.objId, o.X, o.Y, CObj.category.Color());
            }
            else
            {
                UIElement shape = DrawShape(CObj);

                UpdateShapeData(shape, CObj);
            }
        }
Exemplo n.º 2
0
        private UIElement DrawShape(ClassifiedObject CObj)
        {
            SpawnObject o  = CObj.obj;
            uint        id = o.objId;
            double      x  = o.X;
            double      y  = o.Y;

            UIElement shape = LookupVector(id);

            if (shape == null)
            {
                shape = CObj.category.Shape();
                StoreVector(id, shape);
                RadarCanvas.Children.Add(shape);
            }

            Canvas.SetTop(shape, y);
            Canvas.SetLeft(shape, x);
            shape.Visibility = Visibility.Visible;

            return(shape);
        }
Exemplo n.º 3
0
        private ClassifiedObject GetNearestVisibleDoodad()
        {
            //find the nearest visible object
            if (doodads != null && doodads.Any())
            {
                double           D2      = double.PositiveInfinity;
                ClassifiedObject nearest = null;
                foreach (ClassifiedObject cd in doodads)
                {
                    double d2 = cd.obj.distNoZ(ArcheBuddyCore.me);
                    //double dx = (cd.doodad.X - ArcheBuddyCore.me.X);
                    //double dy = (cd.doodad.Y - ArcheBuddyCore.me.Y);
                    //double d2 = dx * dx + dy * dy;
                    if (d2 < D2)
                    {
                        nearest = cd;
                        D2      = d2;
                    }
                }

                return(nearest);
            }
            return(null);
        }
Exemplo n.º 4
0
        private void UpdateShapeData(UIElement shape, ClassifiedObject obj)
        {
            if (shape is ITurnable)
            {
                ((ITurnable)shape).Turn(obj.obj.turnAngle);
            }

            //this is ugly, can there be a solution using WPF MVVM Databinding?
            if (obj.obj.type == BotTypes.Housing && shape is IHousing)
            {
                houseScanner.ParseHouse(shape, (Housing)obj.obj);
            }
            else if (obj.category == ObjectCategory.ThunderstruckTree && shape is Tree)
            {
                //this should rarely happen - if a tree turns Thunderstruck while it's on radar, it might keep the same objId
                //so we might need to redraw it
                ((Tree)shape).ThunderStrike();
            }
            else if (obj.category == ObjectCategory.HarvestableTree && shape is Tree)
            {
                //ensure that a fruited tree is not shown as harvestable
                ((Tree)shape).HideFruit();
            }
            else if (obj.obj.type == BotTypes.DoodadObject)
            {
                DoodadObject d = (DoodadObject)obj.obj;
                if (d.id == 1671)
                {
                    UIElement u = LookupText(obj.obj.objId);
                    if (u != null)
                    {
                        ((TextBlock)u).Text = d.name;
                    }
                }
            }
            else if (obj.obj.type == BotTypes.Player)
            {
                Player p = (Player)obj.obj;

                if (shape is IKillable)
                {
                    ((IKillable)shape).Kill(p.isAlive());
                }
                if (shape is IStealthable)
                {
                    bool IsStealthed = false;
                    foreach (Buff b in p.getBuffs())
                    {
                        if (b.name.StartsWith("Stealth"))
                        {
                            IsStealthed = true;
                            break;
                        }
                    }

                    //this player is stealthed, update their vector
                    ((IStealthable)shape).Stealth(IsStealthed);
                }

                //check for trade pack
                ((PlayerShape)shape).ShowTradePack(p.getAllEquipedItems().Any(item => item.equipCell == EquipItemPlace.Unknown && RadarScanner.TradePackNames.Any(item.name.Contains)));
            }
            else if (obj.obj.type == BotTypes.Npc && shape is IStealthable)
            {
                Npc  p           = (Npc)obj.obj;
                bool IsStealthed = false;
                foreach (Buff b in p.getBuffs())
                {
                    if (b.name.StartsWith("Stealth"))
                    {
                        IsStealthed = true;
                        break;
                    }
                }

                //this player is stealthed, update their vector
                ((IStealthable)shape).Stealth(IsStealthed);
            }
        }