What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

[Plugin] AdvancedItemFilter RELOADED !

Status
Not open for further replies.
Thanks a lot mate

Everything you can find in the "/Classes/EvaluableItem.cs" file can be used with

Code:
item.PROPERTY

like

Code:
item.FullName
item.IsGem
item.InventorySquareValue
item.OverallResistancesPct

// EDIT //

And for InfiniteMonkey's suggestion about dropping items on floor, I'll figure a way to code it, tho You'll have to let the "On-the-fly identification" checked.
For a simple reason, I don't want the bot to be slowed down for everyone or block currency farming.
It's gonna be optional ofc. I don't want my bot to force that kind of logic Kappa

Some of the devs have snippets for it, I'll add it as a generic task so I don't have to figure out any execution flow.

Anyway, I have to modify the way "specific tab" stashing works, I want it to work on FullName instead of fixed currency, so people can stash anything in any tabs.
 
Last edited:
Everything you can find in the "/Classes/EvaluableItem.cs" file can be used with

Code:
item.PROPERTY

like

Code:
item.FullName
item.IsGem
item.InventorySquareValue
item.OverallResistancesPct

// EDIT //

And for InfiniteMonkey's suggestion about dropping items on floor, I'll figure a way to code it, tho You'll have to let the "On-the-fly identification" checked.
For a simple reason, I don't want the bot to be slowed down for everyone or block currency farming.
It's gonna be optional ofc. I don't want my bot to force that kind of logic Kappa

Some of the devs have snippets for it, I'll add it as a generic task so I don't have to figure out any execution flow.

Anyway, I have to modify the way "specific tab" stashing works, I want it to work on FullName instead of fixed currency, so people can stash anything in any tabs.
Dude y? It's gonna break my custom shit kappa. No more Mirror Dupe creation task for you tonyx.
 
And for InfiniteMonkey's suggestion about dropping items on floor, I'll figure a way to code it, tho You'll have to let the "On-the-fly identification" checked.
For a simple reason, I don't want the bot to be slowed down for everyone or block currency farming.
It's gonna be optional ofc. I don't want my bot to force that kind of logic Kappa
How exactly does on-the-fly identification work? Whenever I tested it, I just ended up selling a bunch of unidentified rares.
 
How exactly does on-the-fly identification work? Whenever I tested it, I just ended up selling a bunch of unidentified rares.
It identifies as things get picked up. If recipe slider is full for that item. Ie item is not recipe item. I think I was the logic for that and I derped somewhere, and totally forgot.
 
Feature request.

Could you add some delegate to ItemEvaluator so I could add my IItemEvaluator to work with AIF? Right now it's only possible to replace ;/ API lacks in supporting multipe IItemEvaluator (I think, am I wrong?)

I could add my item as Loki.Bot.ItemEvaluator.Instance and AIF will use it as static evaluator but I dont know what does DefaultItemEvaluator do and I'm afraid I'll fuck something up. - Not going to work
 
Last edited:
Feature request.

Could you add some delegate to ItemEvaluator so I could add my IItemEvaluator to work with AIF? Right now it's only possible to replace ;/ API lacks in supporting multipe IItemEvaluator (I think, am I wrong?)
Neat Idea.
 
Feature request.

Could you add some delegate to ItemEvaluator so I could add my IItemEvaluator to work with AIF? Right now it's only possible to replace ;/ API lacks in supporting multipe IItemEvaluator (I think, am I wrong?)

I could add my item as Loki.Bot.ItemEvaluator.Instance and AIF will use it as static evaluator but I dont know what does DefaultItemEvaluator do and I'm afraid I'll fuck something up. - Not going to work


give me an example of usage or the use of it and i'll take a look at it
 
give me an example of usage or the use of it and i'll take a look at it
Doesn't the Evaluator get set on start()? AFIK you gota stop bot and start to load a new eval? Unless we can load multi eval like before.
 
https://stackoverflow.com/questions...re-a-good-practice-for-this/26452223#26452223


AIF overwrites the ItemEvaluator in each tick. Multiple ItemEvaluators that could work at once would be badass.
Had to check to make sure, that's not the case, it only overwrites if it's not said eval.


Code:
 if (Loki.Bot.ItemEvaluator.Instance.Name != ItemEvaluator.Name)
            {
                DefaultItemEvaluator = Loki.Bot.ItemEvaluator.Instance;
                ItemEvaluator.StaticItemEvaluator = DefaultItemEvaluator;
                Loki.Bot.ItemEvaluator.Instance = ItemEvaluator;

                Log.DebugFormat("[{0}] Default ItemEvaluator : {1}", Name, DefaultItemEvaluator.Name);
                Log.DebugFormat("[{0}] AIF ItemEvaluator {1}", Name, Loki.Bot.ItemEvaluator.Instance.Name == ItemEvaluator.Name ? "has been set properly" : "has not been set properly ! BE CAREFUL !");
            }

OH, I get what you are getting at. But why do you need multi evals?
 
Last edited:
Ok here's working example


Code:
       static event Func<string, bool> TheEvent;
       static bool Program_TheEvent(string arg)
        {
            Console.WriteLine("1");
            return false;
        }

        static bool Program_TheEvent2(string arg)
        {
            Console.WriteLine("2");
            return false;
        }

        static bool Program_TheEvent3(string arg)
        {
            Console.WriteLine("3");
            return true;
        }

            TheEvent += Program_TheEvent;
            TheEvent += Program_TheEvent2;
            TheEvent += Program_TheEvent3;

            //Calling each function in the list
            bool isValid = false;
            if (TheEvent != null)
            {
                foreach (Func<string, bool> func in TheEvent.GetInvocationList())
                {
                    isValid = func("s");
                    if (isValid)
                        break;
                    Console.WriteLine("isValid {0}", isValid);
                }
            }
            Console.WriteLine("isValid {0}", isValid);
 
Ok here's working example


Code:
       static event Func<string, bool> TheEvent;
       static bool Program_TheEvent(string arg)
        {
            Console.WriteLine("1");
            return false;
        }

        static bool Program_TheEvent2(string arg)
        {
            Console.WriteLine("2");
            return false;
        }

        static bool Program_TheEvent3(string arg)
        {
            Console.WriteLine("3");
            return true;
        }

            TheEvent += Program_TheEvent;
            TheEvent += Program_TheEvent2;
            TheEvent += Program_TheEvent3;

            //Calling each function in the list
            bool isValid = false;
            if (TheEvent != null)
            {
                foreach (Func<string, bool> func in TheEvent.GetInvocationList())
                {
                    isValid = func("s");
                    if (isValid)
                        break;
                    Console.WriteLine("isValid {0}", isValid);
                }
            }
            Console.WriteLine("isValid {0}", isValid);
It would write 3?
 
OH, I get what you are getting at. But why do you need multi evals?
For my AutoEquip to pickup flasks if they are better than the ones currently held, also item stashing based on their weight. Much easier to write cool stuff than in json.
With this you could edit your QuestPlugin to pickup all those quests stuff just with one file with few lines of code.

It would write 3?
It would break on the first function that returns true.
 
For my AutoEquip to pickup flasks if they are better than the ones currently held, also item stashing based on their weight. Much easier to write cool stuff than in json.
With this you could edit your QuestPlugin to pickup all those quests stuff just with one file with few lines of code.
We have python for that, and Quest items are picked up by default. I have that check in QP's Tick because I need to know if it's actually picked up. Since OnLoot does a notify of an attempt, but has no return if it's actually picked up.
 
We have python for that, and Quest items are picked up by default. I have that check in QP's Tick because I need to know if it's actually picked up. Since OnLoot does a notify of an attempt, but has no return if it's actually picked up.

I know we have python, but that would be much easier and won't require forking the whole AIF (in my cause it would be a must) + cool feature for future stuff.
 
I know we have python, that would be much easier and won't require forking the whole AIF (in my cause it would be a must).
Still don't get what you are trying to do, if you customize something, talk to tony about adding it into AIF, otherwise, be like me and keep a separate copy.
 
Still don't get what you are trying to do, if you customize something, talk to tony about adding it into AIF, otherwise, be like me and keep a separate copy.

The problem with forking is that each time tony's realease new version I'd need to check every file for changes he made. And he's not releasing them in small portions, it's always huge big ass whole new logic updates :D
 
The problem with forking is that each time tony's realease new version I'd need to check every file for changes he made. And he's not releasing them in small portions, it's always huge big ass whole new logic updates :D
Ah, what I do is just make my tasks on my own file and call it. That's the jist of it. Talk to tonyx and tell him what you did, he's really, easy on things like this. Just don't tell him his p- nm.
 
Ah, what I do is just make my tasks on my own file and call it. That's the jist of it. Talk to tonyx and tell him what you did, he's really, easy on things like this. Just don't tell him his p- nm.

That wouldn't be the manly way!

Here we go! Working even from inside (static) class, yay! Just what I've wanted.

MyItemEvaluator.cs
Code:
public event Func<Item, EvaluationType, bool> MatchEvent;
at the top of Match (below filter = null)
Code:
            //Calling each function in the event list
            if (MatchEvent != null)
            {
                foreach (var func in MatchEvent.GetInvocationList().Cast<Func<Item, EvaluationType, bool>>())
                    if (func(item, type))
                        return true;
            }

AdvancedItemFilter.cs in Execute method
Code:
if (name == "ItemEvaluatorMatch")
			{
				var itemParam = param[0] as Func<Item, EvaluationType, bool>;
                ItemEvaluator.MatchEvent += itemParam;
                return true;
			}

Example usage:
Code:
public bool MyMatch(Item item, EvaluationType type)
        {
            StashBuddy.Log.DebugFormat("[MyMatch] Found: {0}", item.Name);
            return false;
        }
In Start method
Code:
dynamic[] obj =
            {
                (Func<Item, EvaluationType, bool>)MyMatch
            };

            MiscHelpers.GenericExecute<bool>("AdvancedItemFilter", "ItemEvaluatorMatch", obj );
 
Last edited:
Status
Not open for further replies.
Back
Top