namespace PluginCraftHides
{
using Styx;
using Styx.Common;
using Styx.Common.Helpers;
using Styx.CommonBot;
using Styx.CommonBot.Frames;
using Styx.CommonBot.Inventory;
using Styx.CommonBot.Profiles;
using Styx.CommonBot.Profiles.Quest.Order;
using Styx.Helpers;
using Styx.Pathing;
using Styx.Plugins;
using Styx.WoWInternals;
using Styx.WoWInternals.Misc;
using Styx.WoWInternals.World;
using Styx.WoWInternals.WoWObjects;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Windows.Media;
using System.Xml.Linq;
public class CraftHides : HBPlugin
{
public override string Name { get { return "CraftHides"; } }
public override string Author { get { return "HorribleHeffalump"; } }
public override Version Version { get { return new Version(0,0,0,1); } }
public bool InventoryCheck = false;
private bool _init;
private string LeatherworkingSpellName = "Leatherworking";
private string MagnificentHideSpellName = "Magnificent Hide";
public override void Initialize()
{
if (_init) return;
base.Initialize();
Lua.DoString("SetCVar('AutoLootDefault','1')");
Lua.Events.AttachEvent("LOOT_CLOSED", LootFinished);
Lua.Events.AttachEvent("MAIL_CLOSED", MailboxFinished);
Logging.Write(LogLevel.Normal, Colors.DarkRed, "CraftHides Plugin initialized");
_init = true;
}
private void LootFinished(object sender, LuaEventArgs args)
{
if (InventoryCheck == false)
{
InventoryCheck = true;
}
}
private void MailboxFinished(object sender, LuaEventArgs args)
{
if (InventoryCheck == false)
{
InventoryCheck = true;
}
}
public override void Pulse()
{
if (_init)
if (StyxWoW.Me.IsActuallyInCombat
|| StyxWoW.Me.Mounted
|| StyxWoW.Me.IsDead
|| StyxWoW.Me.IsGhost
) {
return;
}
if (InventoryCheck) {
ProfileHelperFunctionsBase p = new ProfileHelperFunctionsBase();
if (p.GetItemCount(72120) >= 50)
{
Logging.Write(LogLevel.Normal, Colors.DarkRed, "[{0} {1}]: Got {2} leather, creating hide", this.Name, this.Version, p.GetItemCount(72120));
Lua.DoString("CastSpellByName(\"" + LeatherworkingSpellName + "\")");
StyxWoW.Sleep(500);
Lua.DoString("local s for i=1,GetNumTradeSkills() do s=GetTradeSkillInfo(i) if (s==\"" + MagnificentHideSpellName + "\") then DoTradeSkill(i) end end");
StyxWoW.Sleep(4000);
}
InventoryCheck = false;
StyxWoW.SleepForLagDuration();
}
}
}
}