Ministry

Unidentify

Nov 25th, 2012
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6.  
  7. using Zeta;
  8. using Zeta.Common;
  9. using Zeta.CommonBot;
  10. using Zeta.Common.Plugins;
  11. using Zeta.Internals.Actors;
  12.  
  13. namespace Unidentify
  14. {
  15. internal class Unidentify : IPlugin
  16. {
  17. private List<string> m_Blacklist = new List<string>()
  18. {
  19.  
  20. };
  21. #region IPlugin Members
  22.  
  23. public bool Equals(IPlugin other)
  24. {
  25. return Name == other.Name;
  26. }
  27.  
  28. public string Author { get { return "Haigent feat. Ministry"; } }
  29.  
  30. public Version Version { get { return new Version(0, 6); } }
  31.  
  32. public string Name { get { return "LegendaryUnids"; } }
  33.  
  34. public string Description { get { return "Keep all legendaries as unidentified"; } }
  35.  
  36. public Window DisplayWindow { get { return null; } }
  37.  
  38. public void OnPulse()
  39. {
  40. }
  41.  
  42. public void OnInitialize()
  43. {
  44. }
  45.  
  46. public void OnShutdown()
  47. {
  48. UnsubscribeEvents();
  49. }
  50.  
  51. public void OnEnabled()
  52. {
  53. SubscribeEvents();
  54. }
  55.  
  56. public void OnDisabled()
  57. {
  58. UnsubscribeEvents();
  59. }
  60.  
  61. public void Log(string message, LogLevel level = LogLevel.Normal)
  62. {
  63. Logging.Write(level, string.Format("[{0}] {1}", Name, message));
  64. }
  65.  
  66. #endregion
  67.  
  68.  
  69. #region Events
  70.  
  71. private void SubscribeEvents()
  72. {
  73. try
  74. {
  75. GameEvents.OnItemIdentificationRequest += OnItemIdentificationRequest;
  76. }
  77. catch (Exception ex)
  78. {
  79. Log(ex.ToString());
  80. }
  81. }
  82.  
  83. private void UnsubscribeEvents()
  84. {
  85. try
  86. {
  87. GameEvents.OnItemIdentificationRequest -= OnItemIdentificationRequest;
  88. }
  89. catch (Exception ex)
  90. {
  91. Log(ex.ToString());
  92. }
  93. }
  94.  
  95. void OnItemIdentificationRequest(object sender, ItemIdentifyRequestEventArgs args)
  96. {
  97. ACDItem item = args.Item;
  98.  
  99. bool keep = ShouldKeep(item);
  100.  
  101. if (keep)
  102. {
  103. Log("Keep: " + item.ToString());
  104. }
  105.  
  106. args.IgnoreIdentification = keep;
  107. }
  108.  
  109. bool ShouldKeep(ACDItem item)
  110. {
  111. bool keep = false;
  112.  
  113. keep = item.ItemQualityLevel == ItemQuality.Legendary;
  114.  
  115. if (keep == true)
  116. {
  117. return keep;
  118. }
  119.  
  120. return keep;
  121. }
  122.  
  123. #endregion
  124.  
  125. }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment