balabanbal
New Member
- Joined
- Jan 25, 2011
- Messages
- 27
Is there an addon that uses engineering perk synpase springs, that you put on gloves, on cooldown?
using Styx;
using Styx.Common;
using Styx.CommonBot;
using Styx.CommonBot.Routines;
using Styx.MemoryManagement;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Linq;
using System.Xml.Linq;
using System.Diagnostics;
using System.IO;
using System.Xml;
using System.ComponentModel;
using System.Data;
using System;
using System.Linq;
using CommonBehaviors.Actions;
using Styx;
using Styx.CommonBot;
using Styx.Pathing;
using Styx.TreeSharp;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using Action = Styx.TreeSharp.Action;
using System.Drawing;
using Styx;
using Styx.Common;
using Styx.CommonBot;
using Styx.Helpers;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using Styx.Plugins;
using Styx.Common.Plugins;
using Styx.CommonBot.Inventory;
using CommonBehaviors.Actions;
using Styx.Common.Helpers;
using Styx.Helpers;
using Styx.Pathing;
using Styx.TreeSharp;
namespace SynapseUse
{
public class SynapseUse : HBPlugin
{
#region Globals
public override string Name { get { return "Use synapse springs"; } }
public override string Author { get { return "Bloodyfinale"; } }
public override Version Version { get { return new Version(1, 0, 0, 1); } }
public override string ButtonText { get { return "No options ;D"; } }
public override bool WantButton { get { return false; } }
private static LocalPlayer Me { get { return StyxWoW.Me; } }
#endregion
private static Composite UseEquippedItem(uint slot)
{
return new PrioritySelector(
ctx => StyxWoW.Me.Inventory.GetItemBySlot(slot),
new Decorator(
ctx => ctx != null && CanUseEquippedItem((WoWItem)ctx),
new Action(ctx => UseItem((WoWItem)ctx))));
}
private static void UseItem(WoWItem item)
{
if (item != null)
{
item.Use();
}
}
private static bool CanUseEquippedItem(WoWItem item)
{
try
{
var itemSpell = Lua.GetReturnVal<string>("return GetItemSpell(" + item.Entry + ")", 0);
if (string.IsNullOrEmpty(itemSpell))
return false;
return item.Usable && item.Cooldown <= 0;
}
catch
{
return false;
}
}
public override void Pulse()
{
if (Me.Combat
&& Me.CurrentTarget != null){
UseEquippedItem(10);
}
}
}
}
I wrote a little Plugin for you. Which should handle you problem. I had no time for testing. I wasn't sure at which equipslot the item is which has to be used. So if there is a Problem change the ID of the Slot to any slot you need. I had no time for testing.
Code:using Styx; using Styx.Common; using Styx.CommonBot; using Styx.CommonBot.Routines; using Styx.MemoryManagement; using Styx.WoWInternals; using Styx.WoWInternals.WoWObjects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System; using System.Collections.Generic; using System.Threading; using System.Linq; using System.Xml.Linq; using System.Diagnostics; using System.IO; using System.Xml; using System.ComponentModel; using System.Data; using System; using System.Linq; using CommonBehaviors.Actions; using Styx; using Styx.CommonBot; using Styx.Pathing; using Styx.TreeSharp; using Styx.WoWInternals; using Styx.WoWInternals.WoWObjects; using Action = Styx.TreeSharp.Action; using System.Drawing; using Styx; using Styx.Common; using Styx.CommonBot; using Styx.Helpers; using Styx.WoWInternals; using Styx.WoWInternals.WoWObjects; using Styx.Plugins; using Styx.Common.Plugins; using Styx.CommonBot.Inventory; using CommonBehaviors.Actions; using Styx.Common.Helpers; using Styx.Helpers; using Styx.Pathing; using Styx.TreeSharp; namespace SynapseUse { public class SynapseUse : HBPlugin { #region Globals public override string Name { get { return "Use synapse springs"; } } public override string Author { get { return "Bloodyfinale"; } } public override Version Version { get { return new Version(1, 0, 0, 1); } } public override string ButtonText { get { return "No options ;D"; } } public override bool WantButton { get { return false; } } private static LocalPlayer Me { get { return StyxWoW.Me; } } #endregion private static Composite UseEquippedItem(uint slot) { return new PrioritySelector( ctx => StyxWoW.Me.Inventory.GetItemBySlot(slot), new Decorator( ctx => ctx != null && CanUseEquippedItem((WoWItem)ctx), new Action(ctx => UseItem((WoWItem)ctx)))); } private static void UseItem(WoWItem item) { if (item != null) { item.Use(); } } private static bool CanUseEquippedItem(WoWItem item) { try { var itemSpell = Lua.GetReturnVal<string>("return GetItemSpell(" + item.Entry + ")", 0); if (string.IsNullOrEmpty(itemSpell)) return false; return item.Usable && item.Cooldown <= 0; } catch { return false; } } public override void Pulse() { if (Me.Combat && Me.CurrentTarget != null){ UseEquippedItem(10); } } } }
using System;
using Styx;
using Styx.Plugins;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
namespace Synapse
{
public class SynapseUse : HBPlugin
{
#region Globals
public override string Name
{
get { return "Use synapse springs"; }
}
public override string Author
{
get { return "Nobody"; }
}
public override Version Version
{
get { return new Version(1, 0, 0, 1); }
}
public override bool WantButton
{
get { return false; }
}
#endregion
private static void use_item()
{
WoWItem item = StyxWoW.Me.Inventory.GetItemBySlot((uint) WoWInventorySlot.Hands);
if (item == null) return;
var itemSpell = Lua.GetReturnVal<string>("return GetItemSpell(" + item.Entry + ")", 0);
if (string.IsNullOrEmpty(itemSpell))
return;
if (!item.Usable || !(item.Cooldown <= 0)) return;
item.Use();
}
public override void Pulse()
{
if (StyxWoW.Me.Combat
&& StyxWoW.Me.CurrentTarget != null)
{
use_item();
}
}
}
}
I figured out how to use it as a plugin but it wont work. Gloves equipment slot id is 11 btw. I changed it. Also I noticed the new hb release have an option for this as well. But that doenst work either. I tried evey setting.
public enum WoWInventorySlot
{
Head = 0,
Neck = 1,
Shoulder = 2,
Shirt = 3,
Chest = 4,
Waist = 5,
Legs = 6,
Feet = 7,
Wrist = 8,
Hands = 9,
Finger1 = 10,
Finger2 = 11,
Trinket1 = 12,
Trinket2 = 13,
Back = 14,
MainHand = 15,
OffHand = 16,
Ranged = 17,
Tabard = 18,
Bag1 = 19,
Bag2 = 20,
Bag3 = 21,
Bag4 = 22,
}
(uint)WoWInventorySlot.Hands