Skip to content

Instantly share code, notes, and snippets.

@JackCeparou
Created August 27, 2017 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JackCeparou/c483613757cd71ee0f56e83aa05699cd to your computer and use it in GitHub Desktop.
Save JackCeparou/c483613757cd71ee0f56e83aa05699cd to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using System.Linq;
using Turbo.Plugins.Default;
namespace Turbo.Plugins.Resu
{
public class CraftersDelightPlugin : BasePlugin, IInGameWorldPainter
{
public Dictionary<uint, WorldDecoratorCollection> SnoMapping { get; set; }
// if you want an easy option for users
public WorldDecoratorCollection GreaterRiftKeystoneDecorator {
get { return SnoMapping.ContainsKey(2835237830) ? SnoMapping[2835237830] : null; }
set { SnoMapping[2835237830] = value; }
}
public CraftersDelightPlugin()
{
Enabled = true;
}
public override void Load(IController hud)
{
base.Load(hud);
SnoMapping = new Dictionary<uint, WorldDecoratorCollection>();
var blackBrush = Hud.Render.CreateBrush(160, 0, 0, 0, 1);
var whiteBrush = Hud.Render.CreateBrush(160, 255, 255, 255, 1);
var blackFont = Hud.Render.CreateFont("tahoma", 7, 255, 0, 0, 0, true, false, false);
var whiteFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, true, false, false);
//Death Breath => already handled by ItemsPlugin
//AddDecorator(2087837753, Hud.Render.CreateBrush(160, 89, 178, 153, 0), blackBrush, blackFont);
//VeiledCrystal
AddDecorator(3689019703, Hud.Render.CreateBrush(160, 223, 223, 1, 0), blackBrush, blackFont);
//ArcaneDust
AddDecorator(2709165134, Hud.Render.CreateBrush(160, 105, 105, 254, 0), blackBrush, blackFont);
//Gems
// looks like a bit much for 10 gem types ;p
AddDecorator(2979276674, Hud.Render.CreateBrush(160, 82, 107, 173, 0), whiteBrush, whiteFont);
AddDecorator(2979276673, Hud.Render.CreateBrush(160, 82, 107, 173, 0), whiteBrush, whiteFont);
AddDecorator(3446938396, Hud.Render.CreateBrush(160, 113, 0, 175, 0), whiteBrush, whiteFont);
AddDecorator(3446938397, Hud.Render.CreateBrush(160, 113, 0, 175, 0), whiteBrush, whiteFont);
AddDecorator(2838965543, Hud.Render.CreateBrush(160, 14, 167, 12, 0), whiteBrush, whiteFont);
AddDecorator(2838965544, Hud.Render.CreateBrush(160, 14, 167, 12, 0), whiteBrush, whiteFont);
AddDecorator(1019190639, Hud.Render.CreateBrush(160, 157, 21, 8, 0), whiteBrush, whiteFont);
AddDecorator(1019190640, Hud.Render.CreateBrush(160, 157, 21, 8, 0), whiteBrush, whiteFont);
AddDecorator(4267641563, Hud.Render.CreateBrush(160, 163, 98, 7, 0), whiteBrush, whiteFont);
AddDecorator(4267641564, Hud.Render.CreateBrush(160, 163, 98, 7, 0), whiteBrush, whiteFont);
AddDecorator(3256663689, Hud.Render.CreateBrush(160, 82, 107, 173, 0), whiteBrush, whiteFont);
AddDecorator(3256663690, Hud.Render.CreateBrush(160, 82, 107, 173, 0), whiteBrush, whiteFont);
AddDecorator(2883100436, Hud.Render.CreateBrush(160, 113, 0, 175, 0), whiteBrush, whiteFont);
AddDecorator(2883100437, Hud.Render.CreateBrush(160, 113, 0, 175, 0), whiteBrush, whiteFont);
AddDecorator(2561578527, Hud.Render.CreateBrush(160, 14, 167, 12, 0), whiteBrush, whiteFont);
AddDecorator(2561578528, Hud.Render.CreateBrush(160, 14, 167, 12, 0), whiteBrush, whiteFont);
AddDecorator(1603007847, Hud.Render.CreateBrush(160, 157, 21, 8, 0), whiteBrush, whiteFont);
AddDecorator(1603007848, Hud.Render.CreateBrush(160, 157, 21, 8, 0), whiteBrush, whiteFont);
AddDecorator(2058771923, Hud.Render.CreateBrush(160, 163, 98, 7, 0), whiteBrush, whiteFont);
AddDecorator(2058771924, Hud.Render.CreateBrush(160, 163, 98, 7, 0), whiteBrush, whiteFont);
//ForgottenSoul
AddDecorator(2073430088, Hud.Render.CreateBrush(160, 244, 122, 0, 0), blackBrush, blackFont);
//ReusablePart
AddDecorator(3931359676, Hud.Render.CreateBrush(160, 255, 255, 255, 0), blackBrush, blackFont);
//GreaterRiftKeystone
// ???? (item.SnoItem.Sno == 2835237830 || item.SnoItem.Sno == 1955086537 || item.SnoItem.Sno == 1955086538 || item.SnoItem.Sno == 1955086539 || item.SnoItem.Sno == 1955086540 || item.SnoItem.Sno == 1955086541 || item.SnoItem.Sno == 1955086542 || item.SnoItem.Sno == 1955086543 || item.SnoItem.Sno == 1955086544 || item.SnoItem.Sno == 1955086545 || item.SnoItem.Sno == 93346329 || item.SnoItem.Sno == 93346330 || item.SnoItem.Sno == 93346331 || item.SnoItem.Sno == 93346332 || item.SnoItem.Sno == 93346333 || item.SnoItem.Sno == 93346334 || item.SnoItem.Sno == 93346335 || item.SnoItem.Sno == 93346336 || item.SnoItem.Sno == 93346337 || item.SnoItem.Sno == 93346338 || item.SnoItem.Sno == 93346362 || item.SnoItem.Sno == 93346363 || item.SnoItem.Sno == 93346364 || item.SnoItem.Sno == 93346365 || item.SnoItem.Sno == 93346367 || item.SnoItem.Sno == 93346368 || item.SnoItem.Sno == 93346369 || item.SnoItem.Sno == 93346370 || item.SnoItem.Sno == 93346371 || item.SnoItem.Sno == 93346395 || item.SnoItem.Sno == 93346396 || item.SnoItem.Sno == 93346397 || item.SnoItem.Sno == 93346398 || item.SnoItem.Sno == 93346399 || item.SnoItem.Sno == 93346400 || item.SnoItem.Sno == 93346401 || item.SnoItem.Sno == 93346402 || item.SnoItem.Sno == 93346403 || item.SnoItem.Sno == 93346404 || item.SnoItem.Sno == 93346428 || item.SnoItem.Sno == 93346429 || item.SnoItem.Sno == 93346430 || item.SnoItem.Sno == 93346431 || item.SnoItem.Sno == 93346432 || item.SnoItem.Sno == 93346433 || item.SnoItem.Sno == 93346434 || item.SnoItem.Sno == 93346435 || item.SnoItem.Sno == 93346436 || item.SnoItem.Sno == 93346437 || item.SnoItem.Sno == 93346461 || item.SnoItem.Sno == 93346462 || item.SnoItem.Sno == 93346463 || item.SnoItem.Sno == 93346464 || item.SnoItem.Sno == 93346465 || item.SnoItem.Sno == 93346466 || item.SnoItem.Sno == 93346467 || item.SnoItem.Sno == 93346468 || item.SnoItem.Sno == 93346470 || item.SnoItem.Sno == 93346494 || item.SnoItem.Sno == 93346495 || item.SnoItem.Sno == 93346496 || item.SnoItem.Sno == 93346497 || item.SnoItem.Sno == 93346498 || item.SnoItem.Sno == 93346499 || item.SnoItem.Sno == 93346500 || item.SnoItem.Sno == 93346501 || item.SnoItem.Sno == 93346502 || item.SnoItem.Sno == 93346503 || item.SnoItem.Sno == 93346527 || item.SnoItem.Sno == 93346528 || item.SnoItem.Sno == 93346529 || item.SnoItem.Sno == 93346530 || item.SnoItem.Sno == 93346531 || item.SnoItem.Sno == 93346532 || item.SnoItem.Sno == 93346533 || item.SnoItem.Sno == 93346534 || item.SnoItem.Sno == 93346535 || item.SnoItem.Sno == 93346536 || item.SnoItem.Sno == 93346560 || item.SnoItem.Sno == 93346561 || item.SnoItem.Sno == 93346562 || item.SnoItem.Sno == 93346563 || item.SnoItem.Sno == 93346564 || item.SnoItem.Sno == 93346565 || item.SnoItem.Sno == 93346566 || item.SnoItem.Sno == 93346567 || item.SnoItem.Sno == 93346568 || item.SnoItem.Sno == 93346569 || item.SnoItem.Sno == 93346593 || item.SnoItem.Sno == 93346594 || item.SnoItem.Sno == 93346595 || item.SnoItem.Sno == 93346596 || item.SnoItem.Sno == 93346597 || item.SnoItem.Sno == 93346598 || item.SnoItem.Sno == 93346599 || item.SnoItem.Sno == 93346600 || item.SnoItem.Sno == 93346601 || item.SnoItem.Sno == 93346602 || item.SnoItem.Sno == 3080428905)
AddDecorator(2835237830, Hud.Render.CreateBrush(160, 146, 32, 175, 0), whiteBrush, whiteFont);
//BovineBardiche
AddDecorator(2346057823);
//PuzzleRing : why multiple sno, for legacy items ?
AddDecorator(3106130529);
//AddDecorator(3563390265);
//AddDecorator(3717984793);
//AddDecorator(3717982349);
}
private void AddDecorator(uint sno)
{
SnoMapping.Add(sno, new WorldDecoratorCollection(
new MapTextureDecorator(Hud)
{
SnoItem = Hud.Inventory.GetSnoItem(sno),
Radius = 0.6f,
RadiusTransformator = new StandardPingRadiusTransformator(Hud, 500)
{
RadiusMinimumMultiplier = 0.8f,
}
}
));
}
private void AddDecorator(uint sno, IBrush bgBrush, IBrush borderBrush, IFont textFont)
{
SnoMapping.Add(sno, new WorldDecoratorCollection(
new MapTextureDecorator(Hud)
{
SnoItem = Hud.Inventory.GetSnoItem(sno),
Radius = 0.6f,
RadiusTransformator = new StandardPingRadiusTransformator(Hud, 500)
{
RadiusMinimumMultiplier = 0.8f,
}
},
new GroundLabelDecorator(Hud)
{
BackgroundBrush = bgBrush,
BorderBrush = borderBrush,
TextFont = textFont
}
));
}
public void PaintWorld(WorldLayer layer)
{
var items = Hud.Game.Items.Where(item => item.Location == ItemLocation.Floor && SnoMapping.ContainsKey(item.SnoItem.Sno));
foreach (var item in items)
{
SnoMapping[item.SnoItem.Sno].Paint(layer, item, item.FloorCoordinate, item.SnoItem.NameLocalized);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment