Jump to content

IsSpellUsable Always False


RonSwanson

Recommended Posts

So I am working on a new warlock Fight Class in C# and I can get it to cast demon armor but I cant get it to cast any other spells. My debug I get

[D] 23:57:55 - [Spell] Demon Skin (Id found: 687, Name found: Demon Skin, NameInGame found: Demon Skin, Know = True, IsSpellUsable = False)

But that happens for every spell I try to cast. 

Also how would I get a  if statement in the void walker , I need to check if an item = soul shard is in the inventory and the item count >= 1. API would be sexy lmao.

Also how can I set my pet to attack? ObjectManager.Pet doesnt have an attack method.

Also how can I check if my pet is tanking the mob?

Last thing, I need to figure out how check if my target has a curse on him or not.

 

Thanks!

Link to comment
Share on other sites

3 hours ago, Doobie said:

So I am working on a new warlock Fight Class in C# and I can get it to cast demon armor but I cant get it to cast any other spells. My debug I get

[D] 23:57:55 - [Spell] Demon Skin (Id found: 687, Name found: Demon Skin, NameInGame found: Demon Skin, Know = True, IsSpellUsable = False)

But that happens for every spell I try to cast. 

Also how would I get a  if statement in the void walker , I need to check if an item = soul shard is in the inventory and the item count >= 1. API would be sexy lmao.

Also how can I set my pet to attack? ObjectManager.Pet doesnt have an attack method.

Also how can I check if my pet is tanking the mob?

Last thing, I need to figure out how check if my target has a curse on him or not.

 

Thanks!

First tipp: Create a simple xml routine with one spell and the conditions you need and check the generated C# code.

If you want to check items use:

ItemsManager.GetItemCountById(1234) > 0

For your pet attack you could use lua:

Lua.LuaDoString("PetAttack();");

You can check the target of the mob:

WoWUnit target = ObjectManager.Me.TargetObject
if (target.TargetObject != ObjectManager.Pet)
{
   // Do something
}


If you want to check the debuff's at your target:
 

Spell debuff = new Spell("DebuffName");
bool hasDebuff = ObjectManager.Me.TargetObject.HaveBuff(debuff.Ids);


All that stuff is not tested but i hope it will help you out.
Greez iMod

Link to comment
Share on other sites

17 hours ago, iMod said:

First tipp: Create a simple xml routine with one spell and the conditions you need and check the generated C# code.

If you want to check items use:


ItemsManager.GetItemCountById(1234) > 0

For your pet attack you could use lua:


Lua.LuaDoString("PetAttack();");

You can check the target of the mob:


WoWUnit target = ObjectManager.Me.TargetObject
if (target.TargetObject != ObjectManager.Pet)
{
   // Do something
}


If you want to check the debuff's at your target:
 


Spell debuff = new Spell("DebuffName");
bool hasDebuff = ObjectManager.Me.TargetObject.HaveBuff(debuff.Ids);


All that stuff is not tested but i hope it will help you out.
Greez iMod

thanks any clue how to Stop Auto attacks? lmao

Link to comment
Share on other sites

18 minutes ago, iMod said:

Lua.DoString("StopAttack()");

This should prevent you from doing auto attacks, I'm not sure if the bot uses auto attack. if yes it could make problems in stopping it.

Okay I will try think I tried that and it gave me a LUA error ingame dunno if thats a function in Lua. 

Link to comment
Share on other sites

47 minutes ago, Doobie said:

Okay I will try think I tried that and it gave me a LUA error ingame dunno if thats a function in Lua. 

It is a lua function. Which extension are you using?

Link to comment
Share on other sites

32 minutes ago, Doobie said:

Thats the error im getting.

Capture.PNG

oh i think it should be
 

Lua.DoString("StopAttack();");

Forgot the ; at the end of the lua command. If that wont work i'm out of ideas =/ i'm not that pro in lua commands.

Link to comment
Share on other sites

2 minutes ago, iMod said:

oh i think it should be
 


Lua.DoString("StopAttack();");

Forgot the ; at the end of the lua command.

I am using Lua.LuaDoString("StopAttack();");

And am getting the same error are you sure thats a method? Maybe I can try running a macro?

 

Link to comment
Share on other sites

2 minutes ago, iMod said:

Well the documentation says it is
http://wowprogramming.com/docs/api/StopAttack

Hmm I also tried Lua.RunMacroText("/stopattack")

but nothing. I just want to be able to cast an ability without making the bout pulling out its weapon as what caster casts then gets his weapon out. Doesnt make sense. 

Link to comment
Share on other sites

4 minutes ago, Doobie said:

Hmm I also tried Lua.RunMacroText("/stopattack")

but nothing. I just want to be able to cast an ability without making the bout pulling out its weapon as what caster casts then gets his weapon out. Doesnt make sense. 

Damn that was my other idea :D Well maybe you need to check the general bot setting. I'm not sure but i think there was a option for autoattacks.

Found nothing like auto attack in the libs. May thats a question for @Droidz

Link to comment
Share on other sites

15 minutes ago, iMod said:

Damn that was my other idea :D Well maybe you need to check the general bot setting. I'm not sure but i think there was a option for autoattacks.

Found nothing like auto attack in the libs. May thats a question for @Droidz

Okay lol!

[E] 17:15:29 - RunMacroText(string macro): System.NotImplementedException: RunMacroText(string macro) not impremented in WRobot for 1.12.1
   at wManager.Wow.Helpers.Lua.RunMacroText(String macro)

Thats the error I get when I try running a macro in the vanilla API

 

@Droidz Is there a way to control auto attacks like toggle on and off with the C# Api? If not can we get that functonality. As auto attacking is fine levels 1 - 6 for example. But around 10 + ideally a caster will just be casting and wanding. 

Link to comment
Share on other sites

Oh okay xD thats why i was asking what kind of extension you are playing ;) Those lua commands are not available in vanilla i think. So yeah @Droidz need to implement the macro method ;) not sure if that ever happen but just write him a message and ask him about it.

Link to comment
Share on other sites

Use this lua code to disable autoattack:

if (PlayerFrame.inCombat) then ClearTarget(); TargetLastTarget(); end

Don't forget also to put range better than 15 yards at your fightclass (if range is smaller than 15 yards, wrobot relaunch autoattack), you can found this option in top/left of fightclass editor, or you can also with this c# code like here line 19.

 

Link to comment
Share on other sites

4 hours ago, Droidz said:

Use this lua code to disable autoattack:


if (PlayerFrame.inCombat) then ClearTarget(); TargetLastTarget(); end

Don't forget also to put range better than 15 yards at your fightclass (if range is smaller than 15 yards, wrobot relaunch autoattack), you can found this option in top/left of fightclass editor, or you can also with this c# code like here line 19.

 

@iMod

UPDATE: I have figured out how to check how many mobs are attacking me, now I need to check how many are attacking my pet.  (:

 

Works like a charm you are awesome! Okay now my next task that I cant figure out is trying to figure out if I have pulled more then 1 target. Just need to be able to see is more then one target is attacking myself and or my pet :b. The fight class is coming along very nicely, thanks for all the help so far guys :D.

 

Link to comment
Share on other sites

/// <summary>
/// Gets all specified units in the specified range
/// </summary>
/// <param name="range">The range we are looking in</param>
/// <param name="objectType">The type of object we are looking for</param>
/// <returns>Returns a list of all available units of the given type</returns>
public static IEnumerable<WoWUnit> GetUnits(int range, WoWObjectType objectType)
{
   // Get units
   IEnumerable<WoWUnit> results = ObjectManager.GetWoWUnitHostile().Where(u => u.Type == objectType && u.IsAlive && (u.GetDistance <= range) && u.IsAttackable);

   // Return
   return results;
}

Get all mobs who attack your pet in a range of 15 (range based of your character not your pet)

int attackingUnits = This.GetUnits(40, WoWObjectType.Units).Count(t => t.TargetObject == ObjectManager.Pet);

 

Link to comment
Share on other sites

13 hours ago, Droidz said:

Thanks for all the help, do you guys know how to cast wand in C#? I can get the bot to cast it but like it never full casts because it seems like the wand spell keeps just getting toggled. I am using Spell.launch() to fire off the spell "Shoot" @Droidz @iMod

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...