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

BotEvents.Player.OnMobLooted does not fire?

j0achim

New Member
Joined
Jan 15, 2010
Messages
532
Reaction score
15
Hi!


Working on a project, where I'm basically logging everything, but i just cant find any elegant way to determine what mob i have looted what from.

(there is an older similar thread like this on the forum, however i came no longer with what was noted in it here and i was unable to resurrect it as it was archived)


Anyhow this is how i want it to look:
Code:
        Styx.BotEvents.Player.OnMobLooted += OnLoot;
        //Nor does this work:
        Styx.BotEvents.Player.OnMobLooted += new Styx.BotEvents.Player.MobLootedDelegate(OnLoot);

        private void OnLoot(Styx.BotEvents.Player.MobLootedEventArgs args)
        {
            Logging.Write(Color.ForestGreen, "[Testing]: Looted mob ");
            Logging.Write(Color.ForestGreen, "[Testing]: Looted mob " + args.LootedMob.Name + " (" + args.LootedMob.Guid + ")");
        }

OnMobKilled events works flawless.. So atm i store last confirmed kill Guid then when LUA event "CHAT_MSG_LOOT" fires this Guid (LastKillGuid) is stored with the loot. Making it in fights where you have killed more then 1 npc in fight unreliable, as it could be 10 mobs being looted and log would think it was all dropped from last kill.
 
Last edited:
Store all the guids that you kill in an array, pop em off when you get the chat_msg_loot?
 
Problem you never know which Guid you actually loot, and loot order is never actually from first till last killed. And its not allays all mobs drop anything. Thus making it nearly as unreliable.


Which is then why i want to do something like:

Code:
    LastLootGuid = [LEFT][COLOR=#333333]args.LootedMob.Guid;[/COLOR][/LEFT]

As i would think "OnMobLooted" fires internally in Honorbuddy before WoW Client fires "CHAT_MSG_LOOT".


I dont understand why it does not fires since it already logs that in the normal log window in Honorbuddy.
 
Last edited:
I'll post a plugin i wrote to show how it would and should work.
 

Attachments

Heres another attempt, which i am not even sure works, since i dont really know what the property .Looting means, it could mean if that unit is looting or it could mean if I (bot) is looting that unit.

This is using a unitlist approach, then on every pulse i check all units killed if they can be looted, if not they are removed, and if "looting" which i dont know what mean yet ;)


PHP:
namespace Styx.Plugins.PluginClass
{
    using Logic;
    using System;
    using Helpers;
    using Logic.Pathing;
    using System.Threading;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.IO;
    using System.Runtime.InteropServices;
    using System.Xml.Linq;
    using System.Linq;
    using System.Reflection;
    using System.Net;
    using System.IO;
    using System.Drawing;
    using System.Windows.Forms;
    using Styx;
    using Styx.Helpers;
    using Styx.WoWInternals.WoWObjects;
    using Styx.WoWInternals;


    public class jEvent : HBPlugin
    {
        public override string Name { get { return "jEvent"; } }
        public override string Author { get { return "j0achim  "; } }
        public override Version Version { get { return new Version(1, 0, 0, 0); } }
        public override bool WantButton { get { return false; } }




        ulong LootGuid;


        List<Styx.WoWInternals.WoWObjects.WoWUnit> list = new List<Styx.WoWInternals.WoWObjects.WoWUnit>();


        public jEvent()
        {
            Styx.BotEvents.Player.OnMobLooted += new Styx.BotEvents.Player.MobLootedDelegate(OnLoot);
            Styx.BotEvents.Player.OnMobKilled += new Styx.BotEvents.Player.MobKilledDelegate(OnKill);
        }


        private void OnLoot(Styx.BotEvents.Player.MobLootedEventArgs args)
        {
            Logging.Write(Color.ForestGreen, "[jEvent]: Looted mob " + args.LootedMob.Name + " (" + args.LootedMob.Guid + ")");
        }




        private void OnKill(Styx.BotEvents.Player.MobKilledEventArgs args)
        {
            Logging.Write(Color.ForestGreen, "[jEvent]: Killed " + args.KilledMob.Name + " (" + args.KilledMob.Guid + ")");
            list.Add(args.KilledMob);
        }


        public override void Pulse()
        {
            Logging.Write(Color.ForestGreen, "pulse");
            if (list.Count > 0)
            {
                for (int i = list.Count; i > 0; i--)
                {
                    if (list[i - 1].Looting)
                    {
                        //LootGuid = list[i - 1].Guid;
                        Logging.Write(Color.ForestGreen, "Next loot should come from " + list[i - 1].Name + " (" + list[i - 1].Guid + ")");
                    }
                    if (!list[i - 1].Lootable)
                    {
                        Logging.Write(Color.ForestGreen, "Removing " + list[i - 1].Name + " from loot list.");
                        list.Remove(list[i - 1]);
                        //continue;
                    }
                }
            }
        }
    }
}
 
Back
Top