示例#1
0
        private void GetUnitDisplayData(RadarObjectContext context)
        {
            context.visible = true;
            context.rotate = true;
            context.vBuffer = this.vbUnit;
            context.noVertexs = 1;
            context.name = string.Format("{0} ({1})", context.obj.Name, context.obj.Level);
            var unit = (WowUnit)context.obj;

            if (unit.Dead)
            {
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameNPCDead, null);
            }
            else
            {
                if (unit.Rank == WoWClassification.Rare || unit.Rank == WoWClassification.RareElite)
                {
                    context.visible = toggleView.HasFlag(ToggleView.UnitsEnemy);
                    context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameNPCRare, null);
                }
                else
                {
                    switch (unit.UnitReaction)
                    {
                        case UnitReaction.Hostile:
                            context.visible = toggleView.HasFlag(ToggleView.UnitsEnemy);
                            context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameNPCHostile, null);
                            break;
                        case UnitReaction.Neutral:
                            context.visible = toggleView.HasFlag(ToggleView.UnitsNeutral);
                            context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameNPCNeutral, null);
                            break;
                        case UnitReaction.Friendly:
                            context.visible = toggleView.HasFlag(ToggleView.UnitsFreindly);
                            context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameNPCFriendly, null);
                            break;
                    }
                }
            }
        }
示例#2
0
        private void GetPlayerDisplayData(RadarObjectContext context)
        {
            context.rotate = true;
            context.vBuffer = this.vbPlayer;
            context.noVertexs = 2;
            context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNamePlayer, null);
            context.name = string.Format("{0} ({1})", context.obj.Name, context.obj.Level);
            context.visible = toggleView.HasFlag(ToggleView.PlayersAllied);
            var unit = (WowUnit)context.obj;

            if (unit.Dead)
            {
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNamePlayerDead, null);
            }
            else if ((unit.UnitReaction == UnitReaction.Hostile) && (unit.UnitFlags.HasFlag(UnitFlags.PvPFlagged)))
            {
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNamePlayerHostile, context.di);
                context.visible = toggleView.HasFlag(ToggleView.PlayersEnemyFlagged);
            }
            else if (unit.UnitReaction == UnitReaction.Hostile)
            {
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNamePlayerNeutral, context.di);
                context.visible = toggleView.HasFlag(ToggleView.PlayersEnemyUnFlagged);
            }
        }
示例#3
0
 private void GetDynamiDisplayData(RadarObjectContext context)
 {
     context.rotate = true;
     context.vBuffer = this.vbPlayer;
     context.noVertexs = 2;
     context.di = this.settings.GetDisplayItem("[Object: Dynamic]", null);
     context.visible = true;
 }
示例#4
0
        private void GetGameObjectDisplayData(RadarObjectContext context)
        {
            context.visible = true;
            var gameobject = (WowGameObject)context.obj;

            if (gameobject.SubTypeId == GameObjectSubType.Mine)
            {
                context.vBuffer = this.vbMine;
                context.noVertexs = 5;
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameObjectMine, null);
            }
            else if (gameobject.SubTypeId == GameObjectSubType.Herb)
            {
                context.vBuffer = this.vbHerb;
                context.noVertexs = 4;
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameObjectHerb, null);
            }
            else if (gameobject.SubTypeId == GameObjectSubType.Chest)
            {
                if (gameobject.Flags.HasFlag(GameObjectFlags.GO_FLAG_LOCKED))
                {
                    context.vBuffer = this.vbMine;
                    context.noVertexs = 5;
                    context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameObjectTreasureLocked, null);
                }
                else
                {
                    context.vBuffer = this.vbMine;
                    context.noVertexs = 5;
                    context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameObjectTreasure, null);
                }
            }
            else if (gameobject.SubTypeId == GameObjectSubType.Fish)
            {
                context.vBuffer = this.vbHerb;
                context.noVertexs = 4;
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameObjectFish, null);
            }
            else if (gameobject.SubTypeId == GameObjectSubType.Book)
            {
                context.vBuffer = this.vbObject;
                context.noVertexs = 2;
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameObjectBook, null);
            }
            else
            {
                context.vBuffer = this.vbObject;
                context.noVertexs = 2;
                context.di = this.settings.GetDisplayItem(RadarSettings.Constants.SettingNameObjectOther, null);
            }
        }
示例#5
0
        public void PresentWowObject(WowObject WowObject)
        {
            var context = new RadarObjectContext();

            context.di = this.settings.GetDisplayItem("[Object: Other]", null);
            context.vBuffer = this.vbObject;
            context.name = WowObject.Name;
            context.obj = WowObject;

            switch (WowObject.Type)
            {
                case ObjectType.Unit:
                    this.GetUnitDisplayData(context);
                    break;

                case ObjectType.Player:
                    this.GetPlayerDisplayData(context);
                    break;

                case ObjectType.GameObject:
                    this.GetGameObjectDisplayData(context);
                    break;

                //case ObjectType.Corpse:
                //    this.GetCorpseDisplayData(context);
                //    break;
            }

            if (context.visible)
            {

                if (WowObject.Name != null)
                {
                    context.di = this.settings.GetDisplayItem(WowObject.Name.ToLower(), context.di);
                }

                if ((context.di != null) && context.di.Visible)
                {
                    int color = context.di.Color;
                    if (WowObject.IsAlert)
                    {
                        RadarAlert alert = null;
                        if (this.alerts.ContainsKey(WowObject.GUID))
                        {
                            alert = this.alerts[WowObject.GUID];
                        }
                        else
                        {
                            alert = new RadarAlert();
                            alert.flash = context.di.AlertColor;
                            this.alerts.Add(WowObject.GUID, alert);
                        }
                        color = alert.GetAlertColor(context.di.Color);
                    }

                    float x = 2f * (2f / this.scale);
                    this.device.Transform.World = Microsoft.DirectX.Matrix.Scaling(x, x, x);

                    if (context.rotate)
                    {
                        var transforms1 = this.device.Transform;
                        transforms1.World *= Microsoft.DirectX.Matrix.RotationZ(6.283185f - WowObject.Facing);
                    }
                    else if (this.settings.RotateMap)
                    {
                        var transforms2 = this.device.Transform;
                        transforms2.World *= Microsoft.DirectX.Matrix.RotationZ(6.283185f - this.focusObject.Facing);
                    }

                    var transform = this.device.Transform;

                    transform.World *= Microsoft.DirectX.Matrix.Translation(new Microsoft.DirectX.Vector3(WowObject.X, WowObject.Y, WowObject.Z));

                    this.device.RenderState.TextureFactor = color;
                    this.device.TextureState[0].ColorOperation = TextureOperation.Modulate;
                    this.device.TextureState[0].ColorArgument0 = TextureArgument.TextureColor;
                    this.device.TextureState[0].ColorArgument1 = TextureArgument.TFactor;
                    this.device.VertexFormat = VertexFormats.Diffuse | VertexFormats.Position;
                    this.device.SetTexture(0, null);
                    this.device.SetStreamSource(0, context.vBuffer, 0);
                    this.device.DrawPrimitives(PrimitiveType.TriangleList, 0, context.noVertexs);

                    var v = Microsoft.DirectX.Vector3.Project(new Microsoft.DirectX.Vector3(0f, 0f, 0f), this.device.Viewport, this.device.Transform.Projection, this.device.Transform.View, this.device.Transform.World);

                    if (((context.name != null) && !this.hideName) && (context.di.DisplayText != DisplayText.Nothing))
                    {
                        this.font.DrawText(null, context.name, (int)(((int)v.X) + 10), (int)(((int)v.Y) - 4), color);
                    }
                }
            }
        }