Advertisement
zjqyf

GLQ_GoblinPlugin.cs

Nov 18th, 2017
1,006
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.81 KB | None | 0 0
  1. using System.Linq;
  2. using Turbo.Plugins.Default;
  3. namespace Turbo.Plugins.glq
  4. {
  5. public class GLQ_GoblinPlugin : BasePlugin, IInGameWorldPainter
  6. {
  7.  
  8. public WorldDecoratorCollection PortalDecorator { get; set; }
  9.  
  10. public WorldDecoratorCollection MalevolentDecorator { get; set; }
  11. public WorldDecoratorCollection BloodDecorator { get; set; }
  12. public WorldDecoratorCollection OdiousDecorator { get; set; }
  13. public WorldDecoratorCollection GemDecorator { get; set; }
  14. public WorldDecoratorCollection GelatinousDecorator { get; set; }
  15. public WorldDecoratorCollection GildedDecorator { get; set; }
  16. public WorldDecoratorCollection InsufferableDecorator { get; set; }
  17. public WorldDecoratorCollection MenageristDecorator { get; set; }
  18. public WorldDecoratorCollection TreasureDecorator { get; set; }
  19. public WorldDecoratorCollection RainbowDecorator { get; set; }
  20. public WorldDecoratorCollection FiendDecorator { get; set; }
  21. public bool EnableSpeak { get; set; }
  22. public string MalevolentSpeak { get; set; }
  23. public string BloodSpeak { get; set; }
  24. public string OdiousSpeak { get; set; }
  25. public string GemSpeak { get; set; }
  26. public string GelatinousSpeak { get; set; }
  27. public string GildedSpeak { get; set; }
  28. public string InsufferableSpeak { get; set; }
  29. public string MenageristSpeak { get; set; }
  30. public string TreasureSpeak { get; set; }
  31. public string RainbowSpeak { get; set; }
  32. public string FiendSpeak { get; set; }
  33.  
  34.  
  35. public GLQ_GoblinPlugin() {
  36. Enabled = true;
  37. EnableSpeak = true;
  38. }
  39.  
  40. public override void Load(IController hud) {
  41. base.Load(hud);
  42. MalevolentSpeak = "默认";
  43. BloodSpeak = "默认";
  44. OdiousSpeak = "默认";
  45. GemSpeak = "默认";
  46. GelatinousSpeak = "默认";
  47. GildedSpeak = "默认";
  48. InsufferableSpeak = "默认";
  49. MenageristSpeak = "默认";
  50. TreasureSpeak = "默认";
  51. RainbowSpeak = "默认";
  52. FiendSpeak = "默认";
  53.  
  54. var offsetH = Hud.Window.Size.Height * 0.005f;
  55.  
  56. PortalDecorator = new WorldDecoratorCollection(
  57. new MapShapeDecorator(Hud) {
  58. Brush = Hud.Render.CreateBrush(180, 255, 255, 255, 0),
  59. Radius = 8.0f
  60. },
  61. new MapShapeDecorator(Hud) {
  62. Brush = Hud.Render.CreateBrush(180, 120, 0, 0, 0),
  63. Radius = 2.5f
  64. }
  65. );
  66.  
  67. MalevolentDecorator = new WorldDecoratorCollection(
  68. new GroundLabelDecorator(Hud) {
  69. BackgroundBrush = Hud.Render.CreateBrush(180, 183, 91, 0, 0),
  70. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 0, 0, 0, true, false, false)
  71. },
  72. new MapLabelDecorator(Hud) {
  73. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 183, 91, 0, false, false, 128, 0, 0, 0, true),
  74. RadiusOffset = offsetH,
  75. }
  76. );
  77.  
  78. BloodDecorator = new WorldDecoratorCollection(
  79. new GroundLabelDecorator(Hud) {
  80. BackgroundBrush = Hud.Render.CreateBrush(180, 255, 0, 128, 0),
  81. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 255, 255, 255, true, false, false)
  82. },
  83. new MapLabelDecorator(Hud) {
  84. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 255, 0, 128, false, false, 128, 0, 0, 0, true),
  85. RadiusOffset = offsetH,
  86. }
  87. );
  88.  
  89. OdiousDecorator = new WorldDecoratorCollection(
  90. new GroundLabelDecorator(Hud) {
  91. BackgroundBrush = Hud.Render.CreateBrush(180, 0, 255, 0, 0),
  92. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 0, 0, 0, true, false, false)
  93. },
  94. new MapLabelDecorator(Hud) {
  95. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 0, 255, 0, false, false, 128, 0, 0, 0, true),
  96. RadiusOffset = offsetH,
  97. }
  98. );
  99.  
  100. GemDecorator = new WorldDecoratorCollection(
  101. new GroundLabelDecorator(Hud) {
  102. BackgroundBrush = Hud.Render.CreateBrush(180, 220, 220, 220, 0),
  103. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 0, 0, 0, true, false, false)
  104. },
  105. new MapLabelDecorator(Hud) {
  106. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 220, 220, 220, false, false, 128, 0, 0, 0, true),
  107. RadiusOffset = offsetH,
  108. }
  109. );
  110.  
  111. GelatinousDecorator = new WorldDecoratorCollection(
  112. new GroundLabelDecorator(Hud) {
  113. BackgroundBrush = Hud.Render.CreateBrush(200, 50, 50, 200, 0),
  114. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 255, 255, 255, true, false, false)
  115. },
  116.  
  117. new MapLabelDecorator(Hud) {
  118. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 62, 158, 255, false, false, 128, 0, 0, 0, true),
  119. RadiusOffset = offsetH,
  120. }
  121. );
  122.  
  123. GildedDecorator = new WorldDecoratorCollection(
  124. new GroundLabelDecorator(Hud) {
  125. BackgroundBrush = Hud.Render.CreateBrush(180, 255, 255, 0, 0),
  126. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 0, 0, 0, true, false, false)
  127. },
  128. new MapLabelDecorator(Hud) {
  129. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 255, 255, 0, false, false, 128, 0, 0, 0, true),
  130. RadiusOffset = offsetH,
  131. }
  132. );
  133.  
  134. InsufferableDecorator = new WorldDecoratorCollection(
  135. new GroundLabelDecorator(Hud) {
  136. BackgroundBrush = Hud.Render.CreateBrush(180, 64, 128, 128, 0),
  137. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 0, 0, 0, true, false, false)
  138. },
  139. new MapLabelDecorator(Hud) {
  140. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 64, 128, 128, false, false, 128, 0, 0, 0, true),
  141. RadiusOffset = offsetH,
  142. }
  143. );
  144.  
  145. MenageristDecorator = new WorldDecoratorCollection(
  146. new GroundLabelDecorator(Hud) {
  147. BackgroundBrush = Hud.Render.CreateBrush(180, 56, 1, 185, 0),
  148. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 255, 255, 255, true, false, false)
  149. },
  150. new MapLabelDecorator(Hud) {
  151. LabelFont = Hud.Render.CreateFont("tahoma", 8f, 200, 25, 1, 185, true, false, 128, 255, 255, 255, true),
  152. RadiusOffset = offsetH,
  153. }
  154. );
  155.  
  156. TreasureDecorator = new WorldDecoratorCollection(
  157. new GroundLabelDecorator(Hud) {
  158. BackgroundBrush = Hud.Render.CreateBrush(200, 255, 255, 128, 0),
  159. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 0, 0, 0, true, false, false)
  160. },
  161. new MapLabelDecorator(Hud) {
  162. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 255, 255, 128, false, false, 128, 0, 0, 0, true),
  163. RadiusOffset = offsetH,
  164. }
  165. );
  166.  
  167. RainbowDecorator = new WorldDecoratorCollection(
  168. new GroundLabelDecorator(Hud) {
  169. BackgroundBrush = Hud.Render.CreateBrush(160, 196, 107, 255, 0),
  170. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 0, 0, 0, true, false, false)
  171. },
  172. new MapLabelDecorator(Hud) {
  173. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 196, 107, 255, false, false, 128, 0, 0, 0, true),
  174. RadiusOffset = offsetH,
  175. }
  176. );
  177.  
  178. FiendDecorator = new WorldDecoratorCollection(
  179. new GroundLabelDecorator(Hud) {
  180. BackgroundBrush = Hud.Render.CreateBrush(160, 255, 163, 15, 0),
  181. TextFont = Hud.Render.CreateFont("tahoma", 10, 255, 0, 0, 0, true, false, false)
  182. },
  183. new MapLabelDecorator(Hud) {
  184. LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 255, 163, 15, false, false, 128, 0, 0, 0, true),
  185. RadiusOffset = offsetH,
  186. }
  187. );
  188.  
  189. }
  190.  
  191.  
  192. public void PaintWorld(WorldLayer layer) {
  193.  
  194. var portals = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._treasuregoblin_portal_open);
  195.  
  196. foreach (var actor in portals) {
  197. PortalDecorator.Paint(layer, actor, actor.FloorCoordinate, null);
  198. }
  199.  
  200.  
  201. var monsters = Hud.Game.AliveMonsters;
  202. foreach (var monster in monsters) {
  203. var name = monster.SnoMonster.NameEnglish;
  204. switch (name) {
  205. case "Malevolent Tormentor":
  206. MalevolentDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  207. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && MalevolentSpeak != "")
  208. {
  209. if(MalevolentSpeak == "默认")
  210. {
  211. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  212. }
  213. else
  214. {
  215. Hud.Sound.Speak(MalevolentSpeak);
  216. }
  217. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  218.  
  219. }
  220. break;
  221. case "Blood Thief":
  222. BloodDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  223. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && BloodSpeak != "")
  224. {
  225. if(BloodSpeak == "默认")
  226. {
  227. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  228. }
  229. else
  230. {
  231. Hud.Sound.Speak(BloodSpeak);
  232. }
  233. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  234.  
  235. }
  236. break;
  237. case "Odious Collector":
  238. OdiousDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  239. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && OdiousSpeak != "")
  240. {
  241. if(OdiousSpeak == "默认")
  242. {
  243. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  244. }
  245. else
  246. {
  247. Hud.Sound.Speak(OdiousSpeak);
  248. }
  249. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  250.  
  251. }
  252. break;
  253. case "Gem Hoarder":
  254. GemDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  255. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && GemSpeak != "")
  256. {
  257. if(GemSpeak == "默认")
  258. {
  259. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  260. }
  261. else
  262. {
  263. Hud.Sound.Speak(GemSpeak);
  264. }
  265. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  266.  
  267. }
  268. break;
  269. case "Gelatinous Sire":
  270. GelatinousDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  271. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && GelatinousSpeak != "")
  272. {
  273. if(GelatinousSpeak == "默认")
  274. {
  275. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  276. }
  277. else
  278. {
  279. Hud.Sound.Speak(GelatinousSpeak);
  280. }
  281. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  282.  
  283. }
  284. break;
  285. case "Gelatinous Spawn":
  286. GelatinousDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  287. break;
  288. case "Gilded Baron":
  289. GildedDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  290. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && GildedSpeak != "")
  291. {
  292. if(GildedSpeak == "默认")
  293. {
  294. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  295. }
  296. else
  297. {
  298. Hud.Sound.Speak(GildedSpeak);
  299. }
  300. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  301.  
  302. }
  303. break;
  304. case "Insufferable Miscreant":
  305. InsufferableDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  306. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && InsufferableSpeak != "")
  307. {
  308. if(InsufferableSpeak == "默认")
  309. {
  310. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  311. }
  312. else
  313. {
  314. Hud.Sound.Speak(InsufferableSpeak);
  315. }
  316. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  317.  
  318. }
  319. break;
  320. case "Menagerist Goblin":
  321. MenageristDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  322. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && MenageristSpeak != "")
  323. {
  324. if(MenageristSpeak == "默认")
  325. {
  326. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  327. }
  328. else
  329. {
  330. Hud.Sound.Speak(MenageristSpeak);
  331. }
  332. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  333.  
  334. }
  335. break;
  336. case "Treasure Goblin":
  337. TreasureDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  338. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && TreasureSpeak != "")
  339. {
  340. if(TreasureSpeak == "默认")
  341. {
  342. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  343. }
  344. else
  345. {
  346. Hud.Sound.Speak(TreasureSpeak);
  347. }
  348. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  349.  
  350. }
  351. break;
  352. case "Rainbow Goblin":
  353. RainbowDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  354. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && RainbowSpeak != "")
  355. {
  356. if(RainbowSpeak == "默认")
  357. {
  358. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  359. }
  360. else
  361. {
  362. Hud.Sound.Speak(RainbowSpeak);
  363. }
  364. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  365.  
  366. }
  367. break;
  368. case "Treasure Fiend":
  369. FiendDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  370. if (EnableSpeak && (monster.LastSpeak == null) && Hud.Sound.LastSpeak.TimerTest(2000) && FiendSpeak != "")
  371. {
  372. if(FiendSpeak == "默认")
  373. {
  374. Hud.Sound.Speak(monster.SnoMonster.NameLocalized);
  375. }
  376. else
  377. {
  378. Hud.Sound.Speak(FiendSpeak);
  379. }
  380. monster.LastSpeak = Hud.Time.CreateAndStartWatch();
  381.  
  382. }
  383. break;
  384. }
  385.  
  386. }
  387. }
  388. }
  389. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement