Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Linq;
- using Turbo.Plugins.Default;
- //Inspired by MonsterDensityPlugin (http://www.ownedcore.com/forums/diablo-3/turbohud/turbohud-plugin-review-zone/625142-v7-2-english-glq-monsterdensityplugin.html) by SeaDragon (http://www.ownedcore.com/forums/members/1130723-seadragon.html)
- namespace Turbo.Plugins.Styckz
- {
- public class RiftAndQuestArrow : BasePlugin, IInGameWorldPainter
- {
- public bool ShowGroundLabel { get; set; }
- public bool ShowSearchCircle { get; set; }
- public bool ShowMonsterCircle { get; set; }
- public bool ShowLine { get; set; }
- public bool UseAutoColors { get; set; }
- public int SearchDistance { get; set; }
- public float MinRiftProgress { get; set; }
- public IBrush CustLineBrush { get; set; }
- public WorldDecoratorCollection CustLabelDecorator { get; set; }
- public WorldDecoratorCollection CustCircleDecorator { get; set; }
- public WorldDecoratorCollection CustMarkDecorator { get; set; }
- public IWorldCoordinate MCoordinate { get; set; }
- public int MinCount { get ; set; }
- public RiftAndQuestArrow()
- {
- Enabled = true;
- MinRiftProgress = 0.75f; //Minimum Rift Progress to Display Decorators
- ShowGroundLabel = false; //Show label with CountAroundCheckableMonsterand Progression
- ShowSearchCircle = false; //Show a Cirlce of the Search Area around the Monster
- ShowMonsterCircle = false; //Show a filled Circle at the Monster
- ShowLine = true; //Show a Line from your Character to the Closest Monster that meets the Progress Limit
- UseAutoColors = true; //Use Default colors Disable this and reset the Cust* dectorators to the colors you want to use
- SearchDistance = 30; //How far from to search around the monster for progress
- MinCount = 6; //Minimum Group Size to point to on a Kill Unique Quest
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- CustLineBrush = Hud.Render.CreateBrush(110, 0, 255, 255, 25f,SharpDX.Direct2D1.DashStyle.Solid, SharpDX.Direct2D1.CapStyle.Round, SharpDX.Direct2D1.CapStyle.Triangle);
- CustLabelDecorator = new WorldDecoratorCollection(
- new GroundLabelDecorator(Hud)
- {
- BackgroundBrush = Hud.Render.CreateBrush(80, 0, 0, 0, 0),
- TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 0, 255, 255, true, false, 160, 0, 0, 0, true),
- }
- );
- CustMarkDecorator = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(90, 0, 255, 255, 0),
- Radius = 1.0f,
- }
- );
- CustCircleDecorator = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(255, 0, 255, 255, 1.5f),
- Radius = SearchDistance,
- }
- );
- }
- private IQuest killUniqueQuest
- {
- get
- {
- return Hud.Game.Quests.FirstOrDefault(q =>
- q.SnoQuest.BountyType == BountyType.KillUnique &&
- q.State == QuestState.started &&
- !Hud.Game.Me.IsInTown &&
- q.SnoQuest.UnassignedStepBnetTitleEnglish != "Bounty: Kill Sledge" &&
- ((q.SnoQuest.UnassignedStepBnetTitleEnglish == "Bounty: Kill John Gorham Coffin" && Hud.Game.Me.SnoArea.NameEnglish == "Defiled Crypt") ||
- (q.SnoQuest.UnassignedStepBnetTitleEnglish == "Bounty: Kill Ganthar the Trickster" && Hud.Game.Me.SnoArea.NameEnglish == "Skycrown Battlements") ||
- (q.SnoQuest.UnassignedStepBnetTitleEnglish == "Bounty: Kill Inquisitor Hamath" && Hud.Game.Me.SnoArea.NameEnglish == "Stinging Winds") ||
- (q.SnoQuest.UnassignedStepBnetTitleEnglish == "Bounty: The Matriarch's Bones" && Hud.Game.Me.SnoArea.NameEnglish == "Defiled Crypt") ||
- (q.SnoQuest.UnassignedStepBnetTitleEnglish != "Bounty: Kill John Gorham Coffin" &&
- q.SnoQuest.UnassignedStepBnetTitleEnglish != "Bounty: Kill Ganthar the Trickster" &&
- q.SnoQuest.UnassignedStepBnetTitleEnglish != "Bounty: Kill Inquisitor Hamath" &&
- q.SnoQuest.UnassignedStepBnetTitleEnglish != "Bounty: The Matriarch's Bones" &&
- q.SnoQuest.BountySnoArea == Hud.Game.Me.SnoArea))
- );
- }
- }
- private IQuest clearDungeonQuest
- {
- get
- {
- return Hud.Game.Quests.FirstOrDefault(q => q.SnoQuest.BountyType == BountyType.ClearDungeon && q.State == QuestState.started && (q.SnoQuest.UnassignedStepBnetTitleEnglish.Substring(18) + " Level 2" == Hud.Game.Me.SnoArea.NameEnglish || Hud.Game.Me.SnoArea.NameEnglish.EndsWith(q.SnoQuest.UnassignedStepBnetTitleEnglish.Substring(18))) && !Hud.Game.Me.IsInTown);
- }
- }
- public void PaintWorld(WorldLayer layer)
- {
- if(Hud.Game.SpecialArea != SpecialArea.Rift && Hud.Game.SpecialArea != SpecialArea.GreaterRift && killUniqueQuest == null && clearDungeonQuest == null)return;
- if(UseAutoColors && Hud.Game.SpecialArea == SpecialArea.Rift)
- {
- CustLineBrush = Hud.Render.CreateBrush(110, 198, 107, 52, 25f,SharpDX.Direct2D1.DashStyle.Solid, SharpDX.Direct2D1.CapStyle.Round, SharpDX.Direct2D1.CapStyle.Triangle);
- CustLabelDecorator.GetDecorators<GroundLabelDecorator>().ForEach(d =>
- {
- d.BackgroundBrush = Hud.Render.CreateBrush(80, 0, 0, 0, 0);
- d.TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 198, 107, 52, true, false, 160, 0, 0, 0, true);
- });
- CustMarkDecorator.GetDecorators<GroundCircleDecorator>().ForEach(d =>
- {
- d.Brush = Hud.Render.CreateBrush(90, 198, 107, 52, 0);
- d.Radius = 1.0f;
- });
- CustCircleDecorator.GetDecorators<GroundCircleDecorator>().ForEach(d =>
- {
- d.Brush = Hud.Render.CreateBrush(255, 198, 107, 52, 1.5f);
- d.Radius = SearchDistance;
- });
- }else if(UseAutoColors && Hud.Game.SpecialArea == SpecialArea.GreaterRift)
- {
- CustLineBrush = Hud.Render.CreateBrush(110, 79, 53, 145, 25f,SharpDX.Direct2D1.DashStyle.Solid, SharpDX.Direct2D1.CapStyle.Round, SharpDX.Direct2D1.CapStyle.Triangle);
- CustLabelDecorator.GetDecorators<GroundLabelDecorator>().ForEach(d =>
- {
- d.BackgroundBrush = Hud.Render.CreateBrush(80, 0, 0, 0, 0);
- d.TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 79, 53, 145, true, false, 160, 0, 0, 0, true);
- });
- CustMarkDecorator.GetDecorators<GroundCircleDecorator>().ForEach(d =>
- {
- d.Brush = Hud.Render.CreateBrush(90, 79, 53, 145, 0);
- d.Radius = 1.0f;
- });
- CustCircleDecorator.GetDecorators<GroundCircleDecorator>().ForEach(d =>
- {
- d.Brush = Hud.Render.CreateBrush(255, 79, 53, 145, 1.5f);
- d.Radius = SearchDistance;
- });
- }else if(UseAutoColors){
- CustLineBrush = Hud.Render.CreateBrush(110, 209, 136, 2, 25f,SharpDX.Direct2D1.DashStyle.Solid, SharpDX.Direct2D1.CapStyle.Round, SharpDX.Direct2D1.CapStyle.Triangle);
- CustLabelDecorator.GetDecorators<GroundLabelDecorator>().ForEach(d =>
- {
- d.BackgroundBrush = Hud.Render.CreateBrush(80, 0, 0, 0, 0);
- d.TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 209, 136, 2, true, false, 160, 0, 0, 0, true);
- });
- CustMarkDecorator.GetDecorators<GroundCircleDecorator>().ForEach(d =>
- {
- d.Brush = Hud.Render.CreateBrush(90, 209, 136, 2, 0);
- d.Radius = 1.0f;
- });
- CustCircleDecorator.GetDecorators<GroundCircleDecorator>().ForEach(d =>
- {
- d.Brush = Hud.Render.CreateBrush(255, 209, 136, 2, 1.5f);
- d.Radius = SearchDistance;
- });
- }
- double HighestRiftProgress = 0;
- double ClosestMonsterDist = 10000;
- int CountAroundSelectedMonst = 0;
- var CheckableMonsters = Hud.Game.AliveMonsters.Where (mon => mon.Rarity != ActorRarity.RareMinion && mon.SummonerAcdDynamicId == 0);
- foreach (var CheckableMonster in CheckableMonsters)
- {
- double MonsterRiftProgression = 0;
- int CountAroundCheckableMonster= Hud.Game.AliveMonsters.Count(m => (CheckableMonster.FloorCoordinate.XYZDistanceTo(m.FloorCoordinate) - m.RadiusBottom) <= SearchDistance);
- var MonstersInRangeOfCheckableMons = Hud.Game.AliveMonsters.Where(mm => (CheckableMonster.FloorCoordinate.XYZDistanceTo(mm.FloorCoordinate) - mm.RadiusBottom) <= SearchDistance && mm.SummonerAcdDynamicId == 0 && mm.IsElite && mm.Rarity != ActorRarity.RareMinion || (CheckableMonster.FloorCoordinate.XYZDistanceTo(mm.FloorCoordinate) - mm.RadiusBottom) <= SearchDistance && !mm.IsElite);
- foreach (var MonstersInRangeOfCheckableMon in MonstersInRangeOfCheckableMons)
- {
- if(MonstersInRangeOfCheckableMon.Rarity == ActorRarity.Rare || MonstersInRangeOfCheckableMon.Rarity == ActorRarity.Champion){
- MonsterRiftProgression += (MonstersInRangeOfCheckableMon.SnoMonster.RiftProgression + 30) * 100.0d / this.Hud.Game.MaxQuestProgress;
- }else{
- MonsterRiftProgression += MonstersInRangeOfCheckableMon.SnoMonster.RiftProgression * 100.0d / this.Hud.Game.MaxQuestProgress;
- }
- }
- if ((Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.GreaterRift) && CheckableMonster.FloorCoordinate.XYZDistanceTo(Hud.Game.Me.FloorCoordinate) < ClosestMonsterDist && MonsterRiftProgression >= MinRiftProgress)
- {
- MCoordinate = CheckableMonster.FloorCoordinate;
- ClosestMonsterDist = CheckableMonster.FloorCoordinate.XYZDistanceTo(Hud.Game.Me.FloorCoordinate);
- CountAroundSelectedMonst = CountAroundCheckableMonster;
- HighestRiftProgress = MonsterRiftProgression;
- }else if (killUniqueQuest != null && CheckableMonster.FloorCoordinate.XYZDistanceTo(Hud.Game.Me.FloorCoordinate) < ClosestMonsterDist && CountAroundCheckableMonster> MinCount)
- {
- MCoordinate = CheckableMonster.FloorCoordinate;
- ClosestMonsterDist = CheckableMonster.FloorCoordinate.XYZDistanceTo(Hud.Game.Me.FloorCoordinate);
- CountAroundSelectedMonst = CountAroundCheckableMonster;
- }else if (clearDungeonQuest!= null && CheckableMonster.FloorCoordinate.XYZDistanceTo(Hud.Game.Me.FloorCoordinate) < ClosestMonsterDist && CountAroundCheckableMonster > 0)
- {
- MCoordinate = CheckableMonster.FloorCoordinate;
- ClosestMonsterDist = CheckableMonster.FloorCoordinate.XYZDistanceTo(Hud.Game.Me.FloorCoordinate);
- CountAroundSelectedMonst = CountAroundCheckableMonster;
- }
- }
- foreach (var CheckableMonster in CheckableMonsters)
- {
- if ((Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.GreaterRift) && HighestRiftProgress >= MinRiftProgress)
- {
- if (ShowGroundLabel)
- {
- CustLabelDecorator.Paint(layer, CheckableMonster, MCoordinate, SearchDistance + "yards Density:" + CountAroundSelectedMonst + "| Progression:" + HighestRiftProgress.ToString("f2"));
- }
- if (ShowSearchCircle)
- {
- CustCircleDecorator.Paint(layer, CheckableMonster, MCoordinate, null);
- }
- if (ShowLine)
- {
- CustLineBrush.DrawLineWorld(Hud.Game.Me.FloorCoordinate, MCoordinate);
- }
- if (ShowMonsterCircle)
- {
- CustMarkDecorator.Paint(layer, CheckableMonster, MCoordinate, null);
- }
- }else if(CountAroundSelectedMonst > 1){
- if (ShowGroundLabel)
- {
- CustLabelDecorator.Paint(layer, CheckableMonster, MCoordinate, SearchDistance + "yards Density:" + CountAroundSelectedMonst + "| Progression:" + HighestRiftProgress.ToString("f2"));
- }
- if (ShowSearchCircle)
- {
- CustCircleDecorator.Paint(layer, CheckableMonster, MCoordinate, null);
- }
- if (ShowLine)
- {
- CustLineBrush.DrawLineWorld(Hud.Game.Me.FloorCoordinate, MCoordinate);
- }
- if (ShowMonsterCircle)
- {
- CustMarkDecorator.Paint(layer, CheckableMonster, MCoordinate, null);
- }
- }
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement