void uTankCallBack(int obj, uTank2.LootPlugins.LootAction result, bool getsuccess) { try { if (!getsuccess) { return; } for (int i = 0; i < itemsWaitingForCallback.Count; i++) { ItemWaitingForCallback itemWaitingForCallback = itemsWaitingForCallback[i]; if (itemWaitingForCallback.ItemInfoIdentArgs.IdentifiedItem.Id == obj) { itemsWaitingForCallback.RemoveAt(i); itemWaitingForCallback.ItemInfoCallBack(itemWaitingForCallback.ItemInfoIdentArgs, !result.IsNoLoot, result.IsSalvage, result.RuleName); break; } } } catch (Exception ex) { Debug.LogException(ex); } }
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); }