Ejemplo n.º 1
0
        public bool GetLootRuleInfoFromItemInfo(ItemInfoIdentArgs itemInfoIdentArgs, ItemInfoCallback itemInfoCallback)
        {
            try
            {
                if (uTank2.PluginCore.PC.FLootPluginQueryNeedsID(itemInfoIdentArgs.IdentifiedItem.Id))
                {
                    // public delegate void delFLootPluginClassifyCallback(int obj, LootAction result, bool getsuccess);
                    //uTank2.PluginCore.delFLootPluginClassifyCallback callback = new uTank2.PluginCore.delFLootPluginClassifyCallback(uTankCallBack);
                    //uTank2.PluginCore.PC.FLootPluginClassifyCallback(itemInfoIdentArgs.IdentifiedItem.Id, callback);

                    ItemWaitingForCallback itemWaitingForCallback = new ItemWaitingForCallback(itemInfoIdentArgs, itemInfoCallback);
                    itemsWaitingForCallback.Add(itemWaitingForCallback);

                    uTank2.PluginCore.PC.FLootPluginClassifyCallback(itemInfoIdentArgs.IdentifiedItem.Id, uTankCallBack);
                }
                else
                {
                    uTank2.LootPlugins.LootAction result = uTank2.PluginCore.PC.FLootPluginClassifyImmediate(itemInfoIdentArgs.IdentifiedItem.Id);

                    itemInfoCallback(itemInfoIdentArgs, !result.IsNoLoot, result.IsSalvage, result.RuleName);
                }
            }
            catch (NullReferenceException)             // Virindi tank probably not loaded.
            {
                return(false);
            }

            return(true);
        }
		public bool GetLootRuleInfoFromItemInfo(ItemInfoIdentArgs itemInfoIdentArgs, ItemInfoCallback itemInfoCallback)
		{
			try
			{
				if (uTank2.PluginCore.PC.FLootPluginQueryNeedsID(itemInfoIdentArgs.IdentifiedItem.Id))
				{
					// public delegate void delFLootPluginClassifyCallback(int obj, LootAction result, bool getsuccess);
					//uTank2.PluginCore.delFLootPluginClassifyCallback callback = new uTank2.PluginCore.delFLootPluginClassifyCallback(uTankCallBack);
					//uTank2.PluginCore.PC.FLootPluginClassifyCallback(itemInfoIdentArgs.IdentifiedItem.Id, callback);

					ItemWaitingForCallback itemWaitingForCallback = new ItemWaitingForCallback(itemInfoIdentArgs, itemInfoCallback);
					itemsWaitingForCallback.Add(itemWaitingForCallback);

					uTank2.PluginCore.PC.FLootPluginClassifyCallback(itemInfoIdentArgs.IdentifiedItem.Id, uTankCallBack);
				}
				else
				{
					uTank2.LootPlugins.LootAction result = uTank2.PluginCore.PC.FLootPluginClassifyImmediate(itemInfoIdentArgs.IdentifiedItem.Id);

					itemInfoCallback(itemInfoIdentArgs, !result.IsNoLoot, result.IsSalvage, result.RuleName);
				}
			}
			catch (NullReferenceException) // Virindi tank probably not loaded.
			{
				return false;
			}

			return true;
		}
Ejemplo n.º 3
0
        void doProcessItemInfoCallback(ItemInfoIdentArgs e, bool itemPassesLootRule, bool isSalvage, string lootRuleName, bool clipboardInfo = false)
        {
            if (e.DontShowIfIsSalvageRule && isSalvage)
            {
                return;
            }

            if (e.DontShowIfItemHasNoRule && string.IsNullOrEmpty(lootRuleName))
            {
                return;
            }

            //<Tell:IIDString:221112:-2024140046>(Epics)<\\Tell>

            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.Append(@"<Tell:IIDString:221112:" + e.IdentifiedItem.Id + @">");

            sb.Append(itemPassesLootRule ? "+" : "-");

            if (!String.IsNullOrEmpty(lootRuleName))
            {
                sb.Append("(" + lootRuleName + ")");
            }

            sb.Append(@"<\\Tell>");

            sb.Append(" ");

            ItemInfo itemInfo = new ItemInfo(e.IdentifiedItem);

            sb.Append(itemInfo);

            MyClasses.VCS_Connector.SendChatTextCategorized("IDs", sb.ToString(), 14, Settings.SettingsManager.Misc.OutputTargetWindow.Value);

            if (clipboardInfo && Settings.SettingsManager.ItemInfoOnIdent.AutoClipboard.Value)
            {
                try
                {
                    System.Text.StringBuilder clipboardBuilder = new System.Text.StringBuilder();

                    clipboardBuilder.Append(itemPassesLootRule ? "+" : "-");

                    if (!String.IsNullOrEmpty(lootRuleName))
                    {
                        clipboardBuilder.Append("(" + lootRuleName + ")");
                    }

                    clipboardBuilder.Append(" ");

                    clipboardBuilder.Append(itemInfo.ToString());

                    System.Windows.Forms.Clipboard.SetDataObject(clipboardBuilder.ToString());
                }
                catch
                {
                }
            }
        }
        void Think()
        {
            if (CoreManager.Current.Actions.OpenedContainer == 0)
            {
                Stop();
                return;
            }

            // Sometimes it takes a bit before we actually get the item information for the items inside the container
            if (CoreManager.Current.WorldFilter.GetByContainer(CoreManager.Current.Actions.OpenedContainer).Count == 0)
            {
                return;
            }

            // Do not show salvage rules for chests and vaults
            bool dontShowIfIsSalvageRule = false;

            WorldObject container = CoreManager.Current.WorldFilter[CoreManager.Current.Actions.OpenedContainer];

            if (container != null && (container.Name.Contains("Chest") || container.Name.Contains("Vault") || container.Name.Contains("Reliquary")))
            {
                dontShowIfIsSalvageRule = true;
            }

            foreach (WorldObject wo in CoreManager.Current.WorldFilter.GetByContainer(CoreManager.Current.Actions.OpenedContainer))
            {
                if (itemsProcessed.Contains(wo.Id))
                {
                    continue;
                }

                itemsProcessed.Add(wo.Id);

                if (ItemIdentified != null)
                {
                    ItemInfoIdentArgs itemInfoIdentArgs = new ItemInfoIdentArgs(wo, true, dontShowIfIsSalvageRule);

                    ItemIdentified(this, itemInfoIdentArgs);
                }
            }

            // Some chests take a few seconds to print out ALL item info
            if (DateTime.Now - startTime < TimeSpan.FromSeconds(5))
            {
                return;
            }

            Stop();
        }
Ejemplo n.º 5
0
        void processDetectedItem(ItemInfoIdentArgs e, bool allowAutoClipboard = false)
        {
            if (virindiTankLootRuleProcessor != null)
            {
                try
                {
                    if (allowAutoClipboard && Settings.SettingsManager.ItemInfoOnIdent.AutoClipboard.Value)
                    {
                        if (virindiTankLootRuleProcessor.GetLootRuleInfoFromItemInfo(e, processItemInfoCallbackWithAutoClipboard))
                        {
                            return;
                        }
                    }
                    else
                    {
                        if (virindiTankLootRuleProcessor.GetLootRuleInfoFromItemInfo(e, processItemInfoCallback))
                        {
                            return;
                        }
                    }
                }
                catch (FileNotFoundException) { virindiTankLootRuleProcessor = null; /* Eat this error (Virindi Tank isn't loaded) */ }
                catch (Exception ex) { Debug.LogException(ex); }
            }

            if (!e.DontShowIfItemHasNoRule)
            {
                ItemInfo itemInfo = new ItemInfo(e.IdentifiedItem);

                MyClasses.VCS_Connector.SendChatTextCategorized("IDs", itemInfo.ToString(), 14, Settings.SettingsManager.Misc.OutputTargetWindow.Value);

                if (allowAutoClipboard && Settings.SettingsManager.ItemInfoOnIdent.AutoClipboard.Value)
                {
                    try
                    {
                        System.Windows.Forms.Clipboard.SetDataObject(itemInfo.ToString());
                    }
                    catch
                    {
                    }
                }
            }
        }
Ejemplo n.º 6
0
		void processDetectedItem(ItemInfoIdentArgs e, bool allowAutoClipboard = false)
		{
			if (virindiTankLootRuleProcessor != null)
			{
				try
				{
					if (allowAutoClipboard && Settings.SettingsManager.ItemInfoOnIdent.AutoClipboard.Value)
					{
						if (virindiTankLootRuleProcessor.GetLootRuleInfoFromItemInfo(e, processItemInfoCallbackWithAutoClipboard))
							return;
					}
					else
					{
						if (virindiTankLootRuleProcessor.GetLootRuleInfoFromItemInfo(e, processItemInfoCallback))
							return;
					}
				}
				catch (FileNotFoundException) { virindiTankLootRuleProcessor = null; /* Eat this error (Virindi Tank isn't loaded) */ }
				catch (Exception ex) { Debug.LogException(ex); }
			}

			if (!e.DontShowIfItemHasNoRule)
			{
				ItemInfo itemInfo = new ItemInfo(e.IdentifiedItem);

				CoreManager.Current.Actions.AddChatText(itemInfo.ToString(), 14, Settings.SettingsManager.Misc.OutputTargetWindow.Value);

				if (allowAutoClipboard && Settings.SettingsManager.ItemInfoOnIdent.AutoClipboard.Value)
				{
					try
					{
						System.Windows.Forms.Clipboard.SetDataObject(itemInfo.ToString());
					}
					catch
					{
					}
				}
			}
		}
        void WorldFilter_ChangeObject(object sender, ChangeObjectEventArgs e)
        {
            try
            {
                if (!Settings.SettingsManager.ItemInfoOnIdent.Enabled.Value)
                {
                    return;
                }

                if (e.Change != WorldChangeType.IdentReceived)
                {
                    return;
                }

                // Remove id's that have been selected more than 10 seconds ago
                while (true)
                {
                    int idToRemove = 0;

                    foreach (KeyValuePair <int, DateTime> pair in itemsSelected)
                    {
                        if (pair.Value + TimeSpan.FromSeconds(10) < DateTime.UtcNow)
                        {
                            idToRemove = pair.Key;
                            break;
                        }
                    }

                    if (idToRemove == 0)
                    {
                        break;
                    }

                    itemsSelected.Remove(idToRemove);
                }

                if (!itemsSelected.ContainsKey(e.Changed.Id))
                {
                    return;
                }

                itemsSelected.Remove(e.Changed.Id);

                if (e.Changed.ObjectClass == ObjectClass.Corpse ||
                    e.Changed.ObjectClass == ObjectClass.Door ||
                    e.Changed.ObjectClass == ObjectClass.Foci ||
                    e.Changed.ObjectClass == ObjectClass.Housing ||
                    e.Changed.ObjectClass == ObjectClass.Lifestone ||
                    e.Changed.ObjectClass == ObjectClass.Npc ||
                    e.Changed.ObjectClass == ObjectClass.Portal ||
                    e.Changed.ObjectClass == ObjectClass.Vendor)
                {
                    return;
                }

                if (ItemIdentified != null)
                {
                    ItemInfoIdentArgs itemInfoIdentArgs = new ItemInfoIdentArgs(e.Changed);

                    ItemIdentified(this, itemInfoIdentArgs);
                }
            }
            catch (Exception ex) { Debug.LogException(ex); }
        }
			public ItemWaitingForCallback(ItemInfoIdentArgs itemInfoIdentArgs, ItemInfoCallback itemInfoCallBack)
			{
				ItemInfoIdentArgs = itemInfoIdentArgs;
				ItemInfoCallBack = itemInfoCallBack;
			}
Ejemplo n.º 9
0
		void Think()
		{
			if (CoreManager.Current.Actions.OpenedContainer == 0)
			{
				Stop();
				return;
			}

			// Sometimes it takes a bit before we actually get the item information for the items inside the container
			if (CoreManager.Current.WorldFilter.GetByContainer(CoreManager.Current.Actions.OpenedContainer).Count == 0)
				return;

			// Do not show salvage rules for chests and vaults
			bool dontShowIfIsSalvageRule = false;

			WorldObject container = CoreManager.Current.WorldFilter[CoreManager.Current.Actions.OpenedContainer];

			if (container != null && (container.Name.Contains("Chest") || container.Name.Contains("Vault") || container.Name.Contains("Reliquary")))
				dontShowIfIsSalvageRule = true;

			foreach (WorldObject wo in CoreManager.Current.WorldFilter.GetByContainer(CoreManager.Current.Actions.OpenedContainer))
			{
				if (itemsProcessed.Contains(wo.Id))
					continue;

				itemsProcessed.Add(wo.Id);

				if (ItemIdentified != null)
				{
					ItemInfoIdentArgs itemInfoIdentArgs = new ItemInfoIdentArgs(wo, true, dontShowIfIsSalvageRule);

					ItemIdentified(this, itemInfoIdentArgs);
				}
			}

			// Some chests take a few seconds to print out ALL item info
			if (DateTime.Now - startTime < TimeSpan.FromSeconds(5))
				return;

			Stop();
		}
Ejemplo n.º 10
0
 void detectItemsInContainers_ItemIdentified(object sender, ItemInfoIdentArgs e)
 {
     processDetectedItem(e);
 }
Ejemplo n.º 11
0
 void detectItemsIdentifiedByUser_ItemIdentified(object sender, ItemInfoIdentArgs e)
 {
     processDetectedItem(e, true);
 }
Ejemplo n.º 12
0
		void processItemInfoCallback(ItemInfoIdentArgs e, bool itemPassesLootRule, bool isSalvage, string lootRuleName)
		{
			doProcessItemInfoCallback(e, itemPassesLootRule, isSalvage, lootRuleName);
		}
Ejemplo n.º 13
0
 void processItemInfoCallback(ItemInfoIdentArgs e, bool itemPassesLootRule, bool isSalvage, string lootRuleName)
 {
     doProcessItemInfoCallback(e, itemPassesLootRule, isSalvage, lootRuleName);
 }
Ejemplo n.º 14
0
 void processItemInfoCallbackWithAutoClipboard(ItemInfoIdentArgs e, bool itemPassesLootRule, bool isSalvage, string lootRuleName)
 {
     doProcessItemInfoCallback(e, itemPassesLootRule, isSalvage, lootRuleName, true);
 }
Ejemplo n.º 15
0
		void processItemInfoCallbackWithAutoClipboard(ItemInfoIdentArgs e, bool itemPassesLootRule, bool isSalvage, string lootRuleName)
		{
			doProcessItemInfoCallback(e, itemPassesLootRule, isSalvage, lootRuleName, true);
		}
		void WorldFilter_ChangeObject(object sender, ChangeObjectEventArgs e)
		{
			try
			{
				if (!Settings.SettingsManager.ItemInfoOnIdent.Enabled.Value)
					return;

				if (e.Change != WorldChangeType.IdentReceived)
					return;

				// Remove id's that have been selected more than 10 seconds ago
				while (true)
				{
					int idToRemove = 0;

					foreach (KeyValuePair<int, DateTime> pair in itemsSelected)
					{
						if (pair.Value + TimeSpan.FromSeconds(10) < DateTime.Now)
						{
							idToRemove = pair.Key;
							break;
						}
					}

					if (idToRemove == 0)
						break;
					
					itemsSelected.Remove(idToRemove);
				}

				if (!itemsSelected.ContainsKey(e.Changed.Id))
					return;

				itemsSelected.Remove(e.Changed.Id);

				if (e.Changed.ObjectClass == ObjectClass.Corpse ||
					e.Changed.ObjectClass == ObjectClass.Door ||
					e.Changed.ObjectClass == ObjectClass.Foci ||
					e.Changed.ObjectClass == ObjectClass.Housing ||
					e.Changed.ObjectClass == ObjectClass.Lifestone ||
					e.Changed.ObjectClass == ObjectClass.Npc ||
					e.Changed.ObjectClass == ObjectClass.Portal ||
					e.Changed.ObjectClass == ObjectClass.Vendor)
					return;

				if (ItemIdentified != null)
				{
					ItemInfoIdentArgs itemInfoIdentArgs = new ItemInfoIdentArgs(e.Changed);

					ItemIdentified(this, itemInfoIdentArgs);
				}
			}
			catch (Exception ex) { Debug.LogException(ex); }
		}
Ejemplo n.º 17
0
		void doProcessItemInfoCallback(ItemInfoIdentArgs e, bool itemPassesLootRule, bool isSalvage, string lootRuleName, bool clipboardInfo = false)
		{
			if (e.DontShowIfIsSalvageRule && isSalvage)
				return;

			if (e.DontShowIfItemHasNoRule && string.IsNullOrEmpty(lootRuleName))
				return;

			//<Tell:IIDString:221112:-2024140046>(Epics)<\\Tell>

			System.Text.StringBuilder sb = new System.Text.StringBuilder();

			sb.Append(@"<Tell:IIDString:221112:" + e.IdentifiedItem.Id + @">");

			sb.Append(itemPassesLootRule ? "+" : "-");

			if (!String.IsNullOrEmpty(lootRuleName))
				sb.Append("(" + lootRuleName + ")");

			sb.Append(@"<\\Tell>");

			sb.Append(" ");

			ItemInfo itemInfo = new ItemInfo(e.IdentifiedItem);

			sb.Append(itemInfo);

			CoreManager.Current.Actions.AddChatText(sb.ToString(), 14, Settings.SettingsManager.Misc.OutputTargetWindow.Value);

			if (clipboardInfo && Settings.SettingsManager.ItemInfoOnIdent.AutoClipboard.Value)
			{
				try
				{
					System.Text.StringBuilder clipboardBuilder = new System.Text.StringBuilder();

					clipboardBuilder.Append(itemPassesLootRule ? "+" : "-");

					if (!String.IsNullOrEmpty(lootRuleName))
						clipboardBuilder.Append("(" + lootRuleName + ")");

					clipboardBuilder.Append(" ");

					clipboardBuilder.Append(itemInfo.ToString());

					System.Windows.Forms.Clipboard.SetDataObject(clipboardBuilder.ToString());
				}
				catch
				{
				}
			}
		}
Ejemplo n.º 18
0
 public ItemWaitingForCallback(ItemInfoIdentArgs itemInfoIdentArgs, ItemInfoCallback itemInfoCallBack)
 {
     ItemInfoIdentArgs = itemInfoIdentArgs;
     ItemInfoCallBack  = itemInfoCallBack;
 }
Ejemplo n.º 19
0
		void detectItemsInContainers_ItemIdentified(object sender, ItemInfoIdentArgs e)
		{
			processDetectedItem(e);
		}
Ejemplo n.º 20
0
		void detectItemsIdentifiedByUser_ItemIdentified(object sender, ItemInfoIdentArgs e)
		{
			processDetectedItem(e, true);
		}