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

[Plugin] OnlyLootGold

Vastico

New Member
Joined
Jul 28, 2011
Messages
424
Reaction score
10
OnlyLootGold is a plugin that only loots gold/silver/copper from killed mobs.

View attachment OnlyLootGold.cs

Instructions
Enable the plugin

Thanks
Let me know of any issues/problem you find with the plugin.

I finally got round to updating this, it's faster at looting and now loots blues and purples.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Styx.Plugins.PluginClass;
using Styx;
using Styx.WoWInternals.WoWObjects;
using Styx.Helpers;
using Styx.Logic.Pathing;
using System.Threading;
using Styx.Logic.Inventory.Frames.LootFrame;
using System.Drawing;
using Styx.WoWInternals;

namespace OnlyLootGold
{

    class OnlyLootGold : HBPlugin
    {

        public OnlyLootGold()
        {            
            BotEvents.Player.OnMobKilled += OnMobKilled;
            Bots.Gatherbuddy.GatherbuddySettings.Instance.LootMobs = false;
            CharacterSettings.Instance.LootMobs = false;
            CharacterSettings.Instance.LootChests = false;
        }

        public override string Author
        {
            get { return "Vastico"; }
        }

        public override string Name
        {
            get { return "OnlyLootGold"; }
        }

        public override Version Version
        {
            get { return new Version(0, 0, 0, 2); }
        }

        private LocalPlayer Me = StyxWoW.Me;
        private WaitTimer lootTimer = new WaitTimer(TimeSpan.FromSeconds(15));
        private Queue<WoWUnit> KilledUnits = new Queue<WoWUnit>();
        private IDictionary<ulong, WaitTimer> Blacklist = new Dictionary<ulong, WaitTimer>();

        public override void Pulse()
        {
            if (Me.Combat || Me.Dead || Me.IsGhost)
            {
                return;
            }
            List<ulong> removals = new List<ulong>();
            foreach (KeyValuePair<ulong, WaitTimer> unit in Blacklist)
            {
                if (unit.Value.IsFinished)
                {
                    removals.Add(unit.Key);
                }
            }
            foreach (ulong remove in removals)
            {
                Blacklist.Remove(remove);
            }
            while (KilledUnits.Count > 0)
            {
                WoWUnit target = KilledUnits.Dequeue();
                if (Blacklist.ContainsKey(target.Guid) || target.Distance > Styx.Logic.LootTargeting.LootRadius)
                {
                    continue;
                }
                WaitTimer lootableTimer = new WaitTimer(TimeSpan.FromMilliseconds(1500));
                lootableTimer.Reset();
                while (!lootableTimer.IsFinished)
                {
                    if (target.Lootable)
                    {
                        break;
                    }
                    System.Threading.Thread.Sleep(20);
                }
                if (!target.Lootable)
                {
                    Logging.Write(Color.Crimson, "Blacklisted [loot][lootable] " + target.Name + ".");
                    Blacklist.Add(target.Guid, new WaitTimer(TimeSpan.FromMinutes(30)));
                    continue;
                }
                WaitTimer movementTimer = new WaitTimer(TimeSpan.FromSeconds(30));
                movementTimer.Reset();
                Logging.Write(Color.Crimson, "Moving to loot items from " + target.Name + ".");
                while (target.Distance > 4 || !target.InLineOfSpellSight && !movementTimer.IsFinished)
                {
                    Navigator.MoveTo(target.Location);
                    System.Threading.Thread.Sleep(20);
                }
                if (target.Distance > 4)
                {
                    Logging.Write(Color.Crimson, "Blacklisted [loot][movement] " + target.Name + ".");
                    Blacklist.Add(target.Guid, new WaitTimer(TimeSpan.FromMinutes(30)));
                }
                else
                {
                    Navigator.PlayerMover.MoveStop();
                    StyxWoW.SleepForLagDuration();
                    target.Interact();
                    StyxWoW.SleepForLagDuration();
                    WaitTimer lootTimer = new WaitTimer(TimeSpan.FromSeconds(5));
                    lootTimer.Reset();
                    Logging.Write(Color.Crimson, "Looting items from " + target.Name + ".");
                    while ((LootFrame.Instance == null || !LootFrame.Instance.IsVisible) && !lootTimer.IsFinished)
                    {
                        System.Threading.Thread.Sleep(20);
                    }
                    if (LootFrame.Instance == null || !LootFrame.Instance.IsVisible)
                    {
                        Blacklist.Add(target.Guid, new WaitTimer(TimeSpan.FromMinutes(30)));
                        Logging.Write(Color.Crimson, "Blacklisted [loot] " + target.Name + ".");
                    }
                    else
                    {
                        StringBuilder builder = new StringBuilder();
                        builder.Append("for i=1,GetNumLootItems() do ");
                            builder.Append("if LootSlotIsCoin(i) then ");
                                builder.Append("LootSlot(i) ConfirmLootSlot(i) ");
                            builder.Append("elseif LootSlotIsItem(i) and select(4, GetLootSlotInfo(i)) > 2 then ");
                                builder.Append("LootSlot(i) ConfirmLootSlot(i) ");
                            builder.Append("end ");
                        builder.Append("end");
                        Lua.DoString(builder.ToString());
                        lootTimer = new WaitTimer(TimeSpan.FromMilliseconds(1500));
                        lootTimer.Reset();
                        while (!lootTimer.IsFinished)
                        {
                            System.Threading.Thread.Sleep(20);
                            Lua.DoString(builder.ToString());
                        }
                        Lua.DoString("CloseLoot()");
                        Logging.Write(Color.Crimson, "Looted items and closed loot frame.");
                    }
                }
            }
        }

        public void OnMobKilled(BotEvents.Player.MobKilledEventArgs args)
        {
            KilledUnits.Enqueue(args.KilledMob);
        }
        
    }

}
 
Last edited:
How does it work with questing? Does it loot the quest items?
 
I guess its for grinding then, since grinding is a risky business we should try to come up with an estimated golf/h at certain mobs/zones
 
I guess its for grinding then, since grinding is a risky business we should try to come up with an estimated golf/h at certain mobs/zones

Yeah thats what I originally made it for (myself), I couldn't afford any bags for my new char so it kept going to vendor every 10 mins
 
You could add option for it to loot blues/epics should it see it
 
I swear if this is the same Vastico that made scripts for RSbuddy and Powerbot so help me I'll use every single thing you make.
 
For me, its not working. It loots everything (Yes, i use the latest HB and yes, the plugin is activated).
 
Could u plz add only loot gold and quest items? I wud def use then and will giv rep. It wud b great for questing as it wont loot all the junk
 
For me, its not working. It loots everything (Yes, i use the latest HB and yes, the plugin is activated).


Haven't used this yet; but is it because you have Auto Loot enabled in the interface option on wow? If so when the plugin goes to loot [as i said haven't used it so don't know how it functions] it may loot all items.
 
I will look at it later the artist formally known as G. You have my promise.
 
Back
Top