namespace PluginTidyBags3
{
using Styx;
using Styx.Common;
using Styx.Common.Helpers;
using Styx.CommonBot.Frames;
using Styx.CommonBot.Inventory;
using Styx.CommonBot.Profiles;
using Styx.Helpers;
using Styx.Pathing;
using Styx.Plugins;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Windows.Media;
using System.Xml.Linq;
public class TidyBags3 : HBPlugin
{
public override string Name { get { return "Tidy Bags 3.6 Reloaded"; } }
public override string Author { get { return "LiquidAtoR"; } }
public override Version Version { get { return new Version(3,6,1,4); } }
private HashSet<uint> _itemUseOnOne = new HashSet<uint>() {
3352, // Ooze-covered Bag
6351, // Dented Crate
6352, // Waterlogged Crate
6353, // Small Chest
6356, // Battered Chest
6357, // Sealed Crate
5523, // Small Barnacled Clam
5524, // Thick-shelled Clam
7973, // Big-mouth Clam
13874, // Heavy Crate
20708, // Tightly Sealed Trunk
20766, // Slimy Bag
20767, // Scum Covered Bag
20768, // Oozing Bag
21113, // Watertight Trunk
21150, // Iron Bound Trunk
21228, // Mithril Bound Trunk
21746, // Lucky Red Envelope (Lunar Festival item)
24476, // Jaggal Clam
24881, // Satchel of Helpful Goods (5-15 1st)
24889, // Satchel of Helpful Goods (5-15 others)
24882, // Satchel of Helpful Goods (15-25 1st)
24890, // Satchel of Helpful Goods (15-25 others)
27481, // Heavy Supply Crate
27511, // Inscribed Scrollcase
27513, // Curious Crate
32724, // Sludge Covered Object
35945, // Brilliant Glass (Daily Cooldown for Jewelcrafting - The Burning Crusade Edition)
36781, // Darkwater Clam
44475, // Reinforced Crate
44663, // Abandoned Adventurer's Satchel
44700, // Brooding Darkwater Clam
45909, // Giant Darkwater Clam
49655, // Lovely Charm (Love is in the Air item)
51999, // Satchel of Helpful Goods (iLevel 25)
52000, // Satchel of Helpful Goods (31)
52001, // Satchel of Helpful Goods (41)
52002, // Satchel of Helpful Goods (50)
52003, // Satchel of Helpful Goods (57)
52004, // Satchel of Helpful Goods (62)
52005, // Satchel of Helpful Goods (66)
52340, // Abyssal Clam
61387, // Hidden Stash
62242, // Icy Prism (Daily Cooldown for Jewelcrafting - Wrath Edition)
64657, // Canopic Jar (Archaeology Tol'vir relic)
67248, // Satchel of Helpful Goods (39)
67250, // Satchel of Helpful Goods (85)
67495, // Strange Bloated Stomach (Cataclysm Skinning)
67539, // Tiny Treasure Chest
67597, // Sealed Crate (level 85 version)
69903, // Satchel of Exotic Mysteries (LFD - Extra Reward)
72201, // Plump Intestines (MoP Skinning)
73478, // Fire Prism (Daily Cooldown for Jewelcrafting - Cataclysm Edition)
78890, // Crystalline Geode (Dragon Soul Raid - Normal 10/25 every bossloot)
78891, // Elementium-Coated Geode (Dragon Soul Raid - Normal 10/25 Deathwing Kill)
78892, // Perfect Geode (Dragon Soul Raid - Heroic Hardmode 10/25 Deathwing Kill)
78897, // Pouch o' Tokens (5 Darkmoon Faire Game Coins)
78898, // Sack o' Tokens (20 Darkmoon Faire Game Coins)
78899, // Pouch o' Tokens (5 Darkmoon Faire Game Coins)
78900, // Pouch o' Tokens (5 Darkmoon Faire Game Coins)
78901, // Pouch o' Tokens (5 Darkmoon Faire Game Coins)
78902, // Pouch o' Tokens (5 Darkmoon Faire Game Coins)
78903, // Pouch o' Tokens (5 Darkmoon Faire Game Coins)
78905, // Sack o' Tokens (20 Darkmoon Faire Game Coins)
78906, // Sack o' Tokens (20 Darkmoon Faire Game Coins)
78907, // Sack o' Tokens (20 Darkmoon Faire Game Coins)
78908, // Sack o' Tokens (20 Darkmoon Faire Game Coins)
78909, // Sack o' Tokens (20 Darkmoon Faire Game Coins)
78930, // Sealed Crate (around the Darkmoon Faire Island)
87391, // Plundered Treasure (Luck of the Lotus Buff)
88496, // Sealed Crate (MoP version)
89613, // Cache of Treasures
89810, // Bounty of a Sundered Land (LFR Contains 25G if you don't win gear)
90716 // Good Fortune (when using a Lucky Charm on a boss for loot)
};
private HashSet<uint> _itemUseOnFive = new HashSet<uint>() {
33567, // Borean Leather Scraps
72162 // Sha touched leather
};
private HashSet<uint> _itemUseOnTen = new HashSet<uint>() {
22572, // Mote of Air
22573, // Mote of Earth
22574, // Mote of Fire
22575, // Mote of Life
22576, // Mote of Mana
22577, // Mote of Shadow
22578, // Mote of Water
37700, // Crystallized Air
37701, // Crystallized Earth
37702, // Crystallized Fire
37703, // Crystallized Shadow
37704, // Crystallized Life
37705, // Crystallized Water
86547, // Skyshard
89112 // Mote of Harmony
};
private HashSet<uint> _itemRequiresSleep = new HashSet<uint>() {
61387, // Hidden Stash
67495, // Strange Bloated Stomach
67539, // Tiny Treasure Chest
72201, // Plump Intestines
87391, // Plundered Treasure (Luck of the Lotus Buff)
89613, // Cache of Treasures
90716, // Good Fortune
72162 // sha touched leather
};
private HashSet<uint> _destroyItems = new HashSet<uint>() {
45196, //Tattered Cloth
45189, //Torn Sail
45188, //Whitered Kelp
45195, //Empty Rum Botlle
45191, //Empty Clam
45194, //Tangled Fishing Line
45201, //Rock
45190, //Driftwood
45200, //Sickly Fish
45198, //Weeds
44941, //Fresh-Squeezed Limeade
45197, //Tree Branch
45199 //Old Boot
};
private static Stopwatch sw = new Stopwatch();
public override void Pulse()
{
if (StyxWoW.Me.IsActuallyInCombat
|| StyxWoW.Me.Mounted
|| StyxWoW.Me.IsDead
|| StyxWoW.Me.IsGhost
//|| Styx.CommonBot.LootTargeting.LootMobs
) {
return;
}
if (!sw.IsRunning) {
sw.Start();
}
if (sw.Elapsed.TotalSeconds > 1) { // throttle to 1s
foreach (WoWItem item in ObjectManager.GetObjectsOfType<WoWItem>()) { // iterate over every item
if (item != null && item.BagSlot != -1) { // check if item exists and is in bag
if (_itemUseOnFive.Contains(item.Entry)) { // stacks of 5
if (item.StackCount >= 5) {
this.useItem(item);
}
} else if (_itemUseOnTen.Contains(item.Entry)) { // stacks of 10
if (item.StackCount >= 10) {
this.useItem(item);
}
} else if (_itemUseOnOne.Contains(item.Entry)) { // stacks of 1
if (item.StackCount >= 1) {
this.useItem(item);
}
} else if (_destroyItems.Contains(item.Entry)) {
this.destroyItem(item);
}
}
}
StyxWoW.SleepForLagDuration();
sw.Reset();
sw.Start();
}
}
private void useItem(WoWItem item)
{
Logging.Write(LogLevel.Normal, Colors.DarkRed, "[{0} {1}]: Using {2} we have {3}", this.Name, this.Version, item.Name, item.StackCount);
if (_itemRequiresSleep.Contains(item.Entry)) {
// some (soulbound) items require an additional sleep to prevent a loot bug
StyxWoW.SleepForLagDuration();
}
Lua.DoString("UseItemByName(\"" + item.Name + "\")");
StyxWoW.SleepForLagDuration();
}
private void destroyItem(WoWItem item)
{
item.PickUp();
Lua.DoString("DeleteCursorItem()");
}
}
}