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

[Solved] Events OnItemStashed / OnItemLooted not fired

deadbull

New Member
Joined
Sep 6, 2014
Messages
17
Reaction score
1
I have a little question :

In references of demonbuddy i can see OnItemDropped and OnItemStashed event but i have some trouble with theses functions.

In my plugin i use OnGameJoined, OnEnabled, OnDisabled,OnItemDropped without any problems, but OnItemLooted and OnItemStashed are simply not fired :/, i'm not sure but i think trinity overwrite the drop & stash function of the botbase of demonbuddy so theses events are not fired, do u have inforrmations about that and how catch stashed / Dropped Item managed by trinity ?
Here is my code if u don't understand what i mean ^^

Thanks in advance for any help
using System;
using System.ComponentModel;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;
using System.Threading;
using System.Diagnostics;
using System.Configuration;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Documents;
using Zeta.Common;
using Zeta.Common.Plugins;
using Zeta.Common.Xml;
using Zeta.Bot;
using Zeta.Bot.Profile;
using Zeta.Bot.Profile.Composites;
using Zeta.Game;
using Zeta.Game.Internals.Actors;
using Zeta.Bot.Navigation;
using Zeta.TreeSharp;
using Zeta.XmlEngine;

namespace LootAnnouncer
{


public static class Logger
{
private static readonly log4net.ILog Logging = Zeta.Common.Logger.GetLoggerInstanceForType();

public static void Log(string message, params object[] args)
{
StackFrame frame = new StackFrame(1);
var method = frame.GetMethod();
var type = method.DeclaringType;
Logging.ErrorFormat("[Loot Announcer] " + string.Format(message, args), type.Name);
//Logging.InfoFormat("[Loot Announcer] " + string.Format(message, args), type.Name);
}

public static void Log(string message)
{
Log(message, string.Empty);

}
}

public class LootAnnouncer : IPlugin
{

static readonly string NAME = "Loot Announcer";
static readonly string AUTHOR = "Deadbull";
static readonly Version VERSION = new Version(1, 0, 0);
static readonly string DESCRIPTION = "description";



// Plugin Auth Info
public string Author
{
get
{
return AUTHOR;
}
}
public string Description
{
get
{
return DESCRIPTION;
}
}
public string Name
{
get
{
return NAME;
}
}
public Version Version
{
get
{
return VERSION;
}
}
public Window DisplayWindow { get { return null; } }




///////////////
// DB EVENTS //
public void OnDisabled()
{

GameEvents.OnGameJoined -= GameEvents_OnGameJoined;
GameEvents.OnItemStashed -= GameEvents_OnItemStashed;
GameEvents.OnItemDropped -= GameEvents_OnItemDropped;
GameEvents.OnItemLooted -= GameEvents_OnItemLooted;


}

public void OnEnabled()
{

GameEvents.OnGameJoined += GameEvents_OnGameJoined;
GameEvents.OnItemStashed += GameEvents_OnItemStashed;
GameEvents.OnItemDropped += GameEvents_OnItemDropped;
GameEvents.OnItemLooted += GameEvents_OnItemLooted;
Logger.Log("Enabled");
}

void GameEvents_OnItemDropped(object sender, ItemEventArgs e){
Logger.Log("Item dropped catch"); // Work
}


void GameEvents_OnItemLooted(object sender, ItemLootedEventArgs e){
Logger.Log("Item looted catch"); // Don't work
}

void GameEvents_OnGameJoined(object sender, EventArgs e)
{
Logger.Log("Item drop analysis Start"); // Work

}


void GameEvents_OnItemStashed(object sender, ItemEventArgs e)
{
Logger.Log("Item Stash"); // Don't work
}



public void OnInitialize()
{

}

public void OnShutdown()
{
GameEvents.OnGameJoined -= GameEvents_OnGameJoined;
GameEvents.OnItemStashed -= GameEvents_OnItemStashed;
GameEvents.OnItemDropped -= GameEvents_OnItemDropped;
GameEvents.OnItemLooted -= GameEvents_OnItemLooted;

}

public void OnPulse()
{

}

public bool Equals(IPlugin other)
{
return Name.Equals(other.Name) && Author.Equals(other.Author) && Version.Equals(other.Version);
}


}
}
 
Last edited:
Yes trinity does its own thing.

ItemEvents.OnItemSalvaged += item => LogItem(ItemAction.Salvaged, item);
ItemEvents.OnItemStashed += item => LogItem(ItemAction.Stashed, item);
ItemEvents.OnItemSold += item => LogItem(ItemAction.Sold, item);
ItemEvents.OnItemIdentified += item => LogItem(ItemAction.PickedUp, item);
ItemEvents.OnItemDropped += item => LogItem(ItemAction.Dropped, item);

https://pastebin.com/raw/VLCx8dfZ
 
Thanks for ur fast answer !

I have one last question, after I could manage by myself to finish the plugin, how to integrate trinity references to my project? ( for demonbuddy resources i need to link demonbuddy.exe but for trinity i have no idea :/ )

EDIT :
When in my code i have "using Trinity;" at the top of my plugin, Demonbuddy cry and tell : "Namespace Trinity cannot be found", so i think i need to put some files in my plugin folder or whatever for include trinity functions & hooks but don't know what file is it and where i can find it :/.

Thanks
 
Last edited:
Thanks for ur fast answer !

I have one last question, after I could manage by myself to finish the plugin, how to integrate trinity references to my project? ( for demonbuddy resources i need to link demonbuddy.exe but for trinity i have no idea :/ )

EDIT :
When in my code i have "using Trinity;" at the top of my plugin, Demonbuddy cry and tell : "Namespace Trinity cannot be found", so i think i need to put some files in my plugin folder or whatever for include trinity functions & hooks but don't know what file is it and where i can find it :/.

Thanks

Your best bet is to pull the entire Trinity project off the SVN, load that up into VS, and then build your plugin. That's what I do for routines so that my references all match, e.g.:

Code:
using Trinity.Components.Combat;
using Trinity.Components.Combat.Resources;
using Trinity.Framework;
using Trinity.Framework.Avoidance.Structures;
using Trinity.Framework.Actors.ActorTypes;
using Trinity.Framework.Helpers;
using Trinity.Framework.Objects;
using Trinity.Framework.Reference;
using Trinity.UI;
using Trinity.Settings;
 
Back
Top