• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • [Plugin] OnlyLootGold

    Discussion in 'Archives' started by Vastico, Sep 10, 2011.

    1. Vastico

      Vastico New Member

      Joined:
      Jul 28, 2011
      Messages:
      424
      Likes Received:
      10
      Trophy Points:
      0
      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: Apr 15, 2012
      amputations likes this.
    2. amputations

      amputations Active Member

      Joined:
      Jan 6, 2011
      Messages:
      2,262
      Likes Received:
      11
      Trophy Points:
      38
      Thanks for this! +rep given
       
    3. Theking

      Theking New Member

      Joined:
      Aug 18, 2011
      Messages:
      108
      Likes Received:
      3
      Trophy Points:
      0
      How does it work with questing? Does it loot the quest items?
       
    4. Vastico

      Vastico New Member

      Joined:
      Jul 28, 2011
      Messages:
      424
      Likes Received:
      10
      Trophy Points:
      0
      Nope sorry, this strictly only loots gold/silver/copper.
       
    5. amputations

      amputations Active Member

      Joined:
      Jan 6, 2011
      Messages:
      2,262
      Likes Received:
      11
      Trophy Points:
      38
      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
       
    6. Vastico

      Vastico New Member

      Joined:
      Jul 28, 2011
      Messages:
      424
      Likes Received:
      10
      Trophy Points:
      0
      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
       
    7. lota7

      lota7 Member

      Joined:
      Nov 23, 2010
      Messages:
      108
      Likes Received:
      2
      Trophy Points:
      18
      You could add option for it to loot blues/epics should it see it
       
    8. Herola14

      Herola14 New Member

      Joined:
      Aug 23, 2011
      Messages:
      23
      Likes Received:
      0
      Trophy Points:
      0
      Cool ill try it out thanks!
       
      Last edited: Nov 20, 2011
    9. Dreadlord

      Dreadlord New Member

      Joined:
      Nov 15, 2011
      Messages:
      451
      Likes Received:
      4
      Trophy Points:
      0
    10. Skeptic

      Skeptic New Member

      Joined:
      Mar 3, 2010
      Messages:
      206
      Likes Received:
      0
      Trophy Points:
      0
      Can it do this? I would love it loot blues and epics and gold.
       
    11. Nofie

      Nofie New Member

      Joined:
      Nov 26, 2011
      Messages:
      64
      Likes Received:
      0
      Trophy Points:
      0
      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.
       
    12. Vastico

      Vastico New Member

      Joined:
      Jul 28, 2011
      Messages:
      424
      Likes Received:
      10
      Trophy Points:
      0
      Hi :)
       
    13. Cataphract

      Cataphract Member

      Joined:
      Oct 31, 2011
      Messages:
      159
      Likes Received:
      6
      Trophy Points:
      18
      For me, its not working. It loots everything (Yes, i use the latest HB and yes, the plugin is activated).
       
    14. Vastico

      Vastico New Member

      Joined:
      Jul 28, 2011
      Messages:
      424
      Likes Received:
      10
      Trophy Points:
      0
      Will take a look
       
    15. theatristformallyknownasG

      theatristformallyknownasG Active Member

      Joined:
      Jan 16, 2010
      Messages:
      3,041
      Likes Received:
      8
      Trophy Points:
      38
      Anychance of adding the colour loot option ?

      G
       
    16. Vastico

      Vastico New Member

      Joined:
      Jul 28, 2011
      Messages:
      424
      Likes Received:
      10
      Trophy Points:
      0
      I'll see when I get home.
       
    17. theatristformallyknownasG

      theatristformallyknownasG Active Member

      Joined:
      Jan 16, 2010
      Messages:
      3,041
      Likes Received:
      8
      Trophy Points:
      38
    18. MadDog

      MadDog Well-Known Member

      Joined:
      Nov 5, 2011
      Messages:
      1,249
      Likes Received:
      38
      Trophy Points:
      48
      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
       
    19. carnaGe

      carnaGe New Member

      Joined:
      Nov 1, 2011
      Messages:
      8
      Likes Received:
      0
      Trophy Points:
      0

      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.
       
    20. Vastico

      Vastico New Member

      Joined:
      Jul 28, 2011
      Messages:
      424
      Likes Received:
      10
      Trophy Points:
      0
      I will look at it later the artist formally known as G. You have my promise.
       

    Share This Page