Advertisement
zjqyf

GLQ_EliteMonsterAffixPlugin.cs

Jun 14th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.95 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using Turbo.Plugins.Default;
  3.  
  4. namespace Turbo.Plugins.glq
  5. {
  6. public class GLQ_EliteMonsterAffixPlugin : BasePlugin, IInGameWorldPainter
  7. {
  8.  
  9. public WorldDecoratorCollection WeakDecorator { get; set; }
  10. public Dictionary<MonsterAffix, WorldDecoratorCollection> AffixDecorators { get; set; }
  11. public Dictionary<MonsterAffix, string> CustomAffixNames { get; set; }
  12. public int transparency { get; set; }
  13. public int fontsize { get; set; }
  14.  
  15. public GLQ_EliteMonsterAffixPlugin()
  16. {
  17. Enabled = true;
  18. Order = 20000;
  19. }
  20.  
  21. public override void Load(IController hud)
  22. {
  23. base.Load(hud);
  24. transparency = 150;
  25. fontsize = 10;
  26. CustomAffixNames = new Dictionary<MonsterAffix, string>();
  27. var BorderBrush = Hud.Render.CreateBrush(128, 0, 0, 0, 2);
  28. AffixDecorators = new Dictionary<MonsterAffix, WorldDecoratorCollection>();
  29. AffixDecorators.Add(MonsterAffix.Arcane, new WorldDecoratorCollection(
  30. new GroundLabelDecorator(Hud)
  31. {
  32. BorderBrush = BorderBrush,
  33. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  34. BackgroundBrush = Hud.Render.CreateBrush(transparency, 120, 0, 120, 0),
  35. }
  36. ));
  37. AffixDecorators.Add(MonsterAffix.Desecrator, new WorldDecoratorCollection(
  38. new GroundLabelDecorator(Hud)
  39. {
  40. BorderBrush = BorderBrush,
  41. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  42. BackgroundBrush = Hud.Render.CreateBrush(transparency, 170, 50, 0, 0),
  43. }
  44. ));
  45. AffixDecorators.Add(MonsterAffix.Electrified, new WorldDecoratorCollection(
  46. new GroundLabelDecorator(Hud)
  47. {
  48. BorderBrush = BorderBrush,
  49. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  50. BackgroundBrush = Hud.Render.CreateBrush(transparency, 40, 40, 240, 0),
  51. }
  52. ));
  53. AffixDecorators.Add(MonsterAffix.Frozen, new WorldDecoratorCollection(
  54. new GroundLabelDecorator(Hud)
  55. {
  56. BorderBrush = BorderBrush,
  57. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  58. BackgroundBrush = Hud.Render.CreateBrush(transparency, 0, 0, 120, 0),
  59. }
  60. ));
  61. AffixDecorators.Add(MonsterAffix.FrozenPulse, new WorldDecoratorCollection(
  62. new GroundLabelDecorator(Hud)
  63. {
  64. BorderBrush = BorderBrush,
  65. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  66. BackgroundBrush = Hud.Render.CreateBrush(transparency, 0, 0, 170, 0),
  67. }
  68. ));
  69. AffixDecorators.Add(MonsterAffix.Jailer, new WorldDecoratorCollection(
  70. new GroundLabelDecorator(Hud)
  71. {
  72. BorderBrush = BorderBrush,
  73. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  74. BackgroundBrush = Hud.Render.CreateBrush(transparency, 144, 0, 255, 0),
  75. }
  76. ));
  77. AffixDecorators.Add(MonsterAffix.Juggernaut, new WorldDecoratorCollection(
  78. new GroundLabelDecorator(Hud)
  79. {
  80. BorderBrush = BorderBrush,
  81. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  82. BackgroundBrush = Hud.Render.CreateBrush(transparency, 150, 0, 0, 0),
  83. }
  84. ));
  85. AffixDecorators.Add(MonsterAffix.Molten, new WorldDecoratorCollection(
  86. new GroundLabelDecorator(Hud)
  87. {
  88. BorderBrush = BorderBrush,
  89. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  90. BackgroundBrush = Hud.Render.CreateBrush(transparency, 130, 13, 0, 0),
  91. }
  92. ));
  93. AffixDecorators.Add(MonsterAffix.Mortar, new WorldDecoratorCollection(
  94. new GroundLabelDecorator(Hud)
  95. {
  96. BorderBrush = BorderBrush,
  97. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  98. BackgroundBrush = Hud.Render.CreateBrush(transparency, 170, 50, 0, 0),
  99. }
  100. ));
  101. AffixDecorators.Add(MonsterAffix.Orbiter, new WorldDecoratorCollection(
  102. new GroundLabelDecorator(Hud)
  103. {
  104. BorderBrush = BorderBrush,
  105. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  106. BackgroundBrush = Hud.Render.CreateBrush(transparency, 15, 15, 220, 0),
  107. }
  108. ));
  109. AffixDecorators.Add(MonsterAffix.Plagued, new WorldDecoratorCollection(
  110. new GroundLabelDecorator(Hud)
  111. {
  112. BorderBrush = BorderBrush,
  113. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  114. BackgroundBrush = Hud.Render.CreateBrush(transparency, 0, 180, 0, 0),
  115. }
  116. ));
  117. AffixDecorators.Add(MonsterAffix.Poison, new WorldDecoratorCollection(
  118. new GroundLabelDecorator(Hud)
  119. {
  120. BorderBrush = BorderBrush,
  121. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  122. BackgroundBrush = Hud.Render.CreateBrush(transparency, 0, 120, 0, 0),
  123. }
  124. ));
  125. AffixDecorators.Add(MonsterAffix.Reflect, new WorldDecoratorCollection(
  126. new GroundLabelDecorator(Hud)
  127. {
  128. BorderBrush = BorderBrush,
  129. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  130. BackgroundBrush = Hud.Render.CreateBrush(transparency, 120, 50, 0, 0),
  131. }
  132. ));
  133. AffixDecorators.Add(MonsterAffix.Thunderstorm, new WorldDecoratorCollection(
  134. new GroundLabelDecorator(Hud)
  135. {
  136. BorderBrush = BorderBrush,
  137. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  138. BackgroundBrush = Hud.Render.CreateBrush(transparency, 40, 40, 240, 0),
  139. }
  140. ));
  141. AffixDecorators.Add(MonsterAffix.Waller, new WorldDecoratorCollection(
  142. new GroundLabelDecorator(Hud)
  143. {
  144. BorderBrush = BorderBrush,
  145. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  146. BackgroundBrush = Hud.Render.CreateBrush(transparency, 50, 50, 50, 0),
  147. }
  148. ));
  149. AffixDecorators.Add(MonsterAffix.HealthLink, new WorldDecoratorCollection(
  150. new GroundLabelDecorator(Hud)
  151. {
  152. BorderBrush = BorderBrush,
  153. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  154. BackgroundBrush = Hud.Render.CreateBrush(transparency, 128, 128, 255, 0),
  155. }
  156. ));
  157. AffixDecorators.Add(MonsterAffix.Fast, new WorldDecoratorCollection(
  158. new GroundLabelDecorator(Hud)
  159. {
  160. BorderBrush = BorderBrush,
  161. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  162. BackgroundBrush = Hud.Render.CreateBrush(transparency, 0, 136, 255, 0),
  163. }
  164. ));
  165. AffixDecorators.Add(MonsterAffix.FireChains, new WorldDecoratorCollection(
  166. new GroundLabelDecorator(Hud)
  167. {
  168. BorderBrush = BorderBrush,
  169. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  170. BackgroundBrush = Hud.Render.CreateBrush(transparency, 255, 0, 0, 0),
  171. }
  172. ));
  173. AffixDecorators.Add(MonsterAffix.Knockback, new WorldDecoratorCollection(
  174. new GroundLabelDecorator(Hud)
  175. {
  176. BorderBrush = BorderBrush,
  177. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  178. BackgroundBrush = Hud.Render.CreateBrush(transparency, 128, 128, 128, 0),
  179. }
  180. ));
  181. AffixDecorators.Add(MonsterAffix.Nightmarish, new WorldDecoratorCollection(
  182. new GroundLabelDecorator(Hud)
  183. {
  184. BorderBrush = BorderBrush,
  185. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  186. BackgroundBrush = Hud.Render.CreateBrush(transparency, 0, 128, 128, 0),
  187. }
  188. ));
  189. AffixDecorators.Add(MonsterAffix.Illusionist, new WorldDecoratorCollection(
  190. new GroundLabelDecorator(Hud)
  191. {
  192. BorderBrush = BorderBrush,
  193. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  194. BackgroundBrush = Hud.Render.CreateBrush(transparency, 166, 166, 255, 0),
  195. }
  196. ));
  197. AffixDecorators.Add(MonsterAffix.Shielding, new WorldDecoratorCollection(
  198. new GroundLabelDecorator(Hud)
  199. {
  200. BorderBrush = BorderBrush,
  201. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  202. BackgroundBrush = Hud.Render.CreateBrush(transparency, 150, 180, 150, 0),
  203. }
  204. ));
  205. AffixDecorators.Add(MonsterAffix.Teleporter, new WorldDecoratorCollection(
  206. new GroundLabelDecorator(Hud)
  207. {
  208. BorderBrush = BorderBrush,
  209. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  210. BackgroundBrush = Hud.Render.CreateBrush(transparency, 185, 185, 185, 0),
  211. }
  212. ));
  213. AffixDecorators.Add(MonsterAffix.Vortex, new WorldDecoratorCollection(
  214. new GroundLabelDecorator(Hud)
  215. {
  216. BorderBrush = BorderBrush,
  217. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  218. BackgroundBrush = Hud.Render.CreateBrush(transparency, 255, 255, 255, 0),
  219. }
  220. ));
  221. AffixDecorators.Add(MonsterAffix.Wormhole, new WorldDecoratorCollection(
  222. new GroundLabelDecorator(Hud)
  223. {
  224. BorderBrush = BorderBrush,
  225. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  226. BackgroundBrush = Hud.Render.CreateBrush(transparency, 255, 0, 255, 0),
  227. }
  228. ));
  229. AffixDecorators.Add(MonsterAffix.Avenger, new WorldDecoratorCollection(
  230. new GroundLabelDecorator(Hud)
  231. {
  232. BorderBrush = BorderBrush,
  233. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 0, 0, 0, true, false, false),
  234. BackgroundBrush = Hud.Render.CreateBrush(transparency, 192, 192, 192, 0),
  235. }
  236. ));
  237. AffixDecorators.Add(MonsterAffix.Horde, new WorldDecoratorCollection(
  238. new GroundLabelDecorator(Hud)
  239. {
  240. BorderBrush = BorderBrush,
  241. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  242. BackgroundBrush = Hud.Render.CreateBrush(transparency, 128, 128, 0, 0),
  243. }
  244. ));
  245. AffixDecorators.Add(MonsterAffix.MissileDampening, new WorldDecoratorCollection(
  246. new GroundLabelDecorator(Hud)
  247. {
  248. BorderBrush = BorderBrush,
  249. TextFont = Hud.Render.CreateFont("tahoma", fontsize, 255, 255, 255, 255, true, false, false),
  250. BackgroundBrush = Hud.Render.CreateBrush(transparency, 0, 96, 192, 0),
  251. }
  252. ));
  253. }
  254. public void PaintWorld(WorldLayer layer)
  255. {
  256.  
  257. var monsters = Hud.Game.AliveMonsters;
  258. foreach (var monster in monsters)
  259. {
  260. bool illusionist = false;
  261. if(monster.SummonerAcdDynamicId == 0)
  262. {
  263. illusionist = false;
  264. }
  265. else
  266. {
  267. illusionist = true;
  268. }
  269. if (monster.Rarity == ActorRarity.Normal || monster.Rarity == ActorRarity.Unique || monster.Rarity == ActorRarity.Boss) {
  270. foreach (var snoMonsterAffix in monster.AffixSnoList)
  271. {
  272. WorldDecoratorCollection decorator;
  273. if (!AffixDecorators.TryGetValue(snoMonsterAffix.Affix, out decorator)) continue;
  274.  
  275. string affixName = null;
  276. if (CustomAffixNames.ContainsKey(snoMonsterAffix.Affix))
  277. {
  278. affixName = CustomAffixNames[snoMonsterAffix.Affix];
  279. }
  280. else affixName = snoMonsterAffix.NameLocalized;
  281.  
  282. decorator.Paint(layer, monster, monster.FloorCoordinate, affixName);
  283. }
  284. }
  285.  
  286. if (monster.Rarity == ActorRarity.Champion)
  287. {
  288. if (illusionist == false)
  289. {
  290. foreach (var snoMonsterAffix in monster.AffixSnoList)
  291. {
  292. WorldDecoratorCollection decorator;
  293. if (!AffixDecorators.TryGetValue(snoMonsterAffix.Affix, out decorator)) continue;
  294.  
  295. string affixName = null;
  296. if (CustomAffixNames.ContainsKey(snoMonsterAffix.Affix))
  297. {
  298. affixName = CustomAffixNames[snoMonsterAffix.Affix];
  299. }
  300. else affixName = snoMonsterAffix.NameLocalized;
  301.  
  302. decorator.Paint(layer, monster, monster.FloorCoordinate, affixName);
  303. }
  304. }
  305. }
  306. if (monster.Rarity == ActorRarity.Rare)
  307. {
  308. if (illusionist == false)
  309. {
  310. foreach (var snoMonsterAffix in monster.AffixSnoList)
  311. {
  312. WorldDecoratorCollection decorator;
  313. if (!AffixDecorators.TryGetValue(snoMonsterAffix.Affix, out decorator)) continue;
  314.  
  315. string affixName = null;
  316. if (CustomAffixNames.ContainsKey(snoMonsterAffix.Affix))
  317. {
  318. affixName = CustomAffixNames[snoMonsterAffix.Affix];
  319. }
  320. else affixName = snoMonsterAffix.NameLocalized;
  321.  
  322. decorator.Paint(layer, monster, monster.FloorCoordinate, affixName);
  323. }
  324. }
  325. }
  326. }
  327. }
  328.  
  329. }
  330.  
  331. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement