Jump to content

Getting mana requirement for spells?


Recommended Posts

First i'll just link to what i'm working on. It's a fightclass for Feral Druids (leveling atm, thought it'd be fun to try this out while leveling) https://gist.github.com/Lillecarl/22b3c8170c1070873ca4dfcc607b98ac

Both Spell and SpellInfo classes contain very little information, i'd love to get the power (mana) requirements from spells by their names in some easy fashion.

Can this be done in some way, i skimmed through wManager with dnSpy, but i didn't find anything of use there.

Best Regards
Carl

Link to comment
Share on other sites

3 hours ago, LilleCarl said:

First i'll just link to what i'm working on. It's a fightclass for Feral Druids (leveling atm, thought it'd be fun to try this out while leveling) https://gist.github.com/Lillecarl/22b3c8170c1070873ca4dfcc607b98ac

Both Spell and SpellInfo classes contain very little information, i'd love to get the power (mana) requirements from spells by their names in some easy fashion.

Can this be done in some way, i skimmed through wManager with dnSpy, but i didn't find anything of use there.

Best Regards
Carl

Is your goal to determine whether you have enough mana to cast the spell? If so, then you can use wManager.Wow.Helpers.SpellManager.SpellUsableLUA("Spellname") . Spellusable uses the http://wowwiki.wikia.com/wiki/API_IsUsableSpell so, it's not purely based on mana percentage, but it might accomplish what you want. Currently I don't know if there is a way to find the mana cost of a spell. You may be able to write a dictionary SpellByCost and do that yourself, though.
       

Link to comment
Share on other sites

47 minutes ago, avvi said:

Is your goal to determine whether you have enough mana to cast the spell? If so, then you can use wManager.Wow.Helpers.SpellManager.SpellUsableLUA("Spellname") . Spellusable uses the http://wowwiki.wikia.com/wiki/API_IsUsableSpell so, it's not purely based on mana percentage, but it might accomplish what you want. Currently I don't know if there is a way to find the mana cost of a spell. You may be able to write a dictionary SpellByCost and do that yourself, though.
       

I'll probably go with the latter, the reason IsUsableSpell isn't enough is because sometimes i must check if player has enough mana to cast 2 spells, say i'm in Cat Form and wanna heal myself. Then i better have enough mana to land regrowth and cat form, else i'm better of fighting in catform til i have mana for both :)

 

Imo those are things that should be in the API, to help the community grow! =)

 

I might just extract all spellcosts from dbc files and put them in a dictionary.

Cheers =)

Link to comment
Share on other sites

5 minutes ago, LilleCarl said:

I'll probably go with the latter, the reason IsUsableSpell isn't enough is because sometimes i must check if player has enough mana to cast 2 spells, say i'm in Cat Form and wanna heal myself. Then i better have enough mana to land regrowth and cat form, else i'm better of fighting in catform til i have mana for both :)

 

Imo those are things that should be in the API, to help the community grow! =)

 

I might just extract all spellcosts from dbc files and put them in a dictionary.

Cheers =)

Getting mana spell costs is  difficult to do even in the normal wow LUA scripting. You must extract it from the tooltips. I'm not surprised that this hasn't been implemented by Droidz. You can try implementing the following lua from this post: https://us.battle.net/forums/en/wow/topic/14881058187  and getting the return from that... Even then, this method will be different for each version of the game. a dictionary is probably the easiest solution.

Link to comment
Share on other sites

16 minutes ago, LilleCarl said:

I've already implemented a C# dbc reader from https://github.com/TrinityCore/SpellWork/tree/0.12/ into my fightclass that reads all the spell DBC, it'll be OpenSource once i've cleaned it up to a non embarrassing level.

I have already thought about this option at my current project (https://wrobot.eu/forums/topic/6681-extension-wowdb/) but i wanted to be more compact and converted it to SqLite.

In the end no client actions are needed and i can customize struct definitions (https://github.com/barncastle/WDBXEditor), load it to database and alter it.

I guess i also need to add spell retrieve methods to my manager aswell more client data to db :)

But i'm thinking now it's better to use the reader, because all WRobot libraries already have it.

 

And by the way welcome to WRobot.

 

Link to comment
Share on other sites

On 8/7/2017 at 10:23 PM, reapler said:

I have already thought about this option at my current project (https://wrobot.eu/forums/topic/6681-extension-wowdb/) but i wanted to be more compact and converted it to SqLite.

In the end no client actions are needed and i can customize struct definitions (https://github.com/barncastle/WDBXEditor), load it to database and alter it.

I guess i also need to add spell retrieve methods to my manager aswell more client data to db :)

But i'm thinking now it's better to use the reader, because all WRobot libraries already have it.

 

And by the way welcome to WRobot.

 

Damn you've done some heavy lifting here!

Yes indeed, if you were to convert the Spell*.dbc files into .SQL (i could assist you with that if you're interested) then that looks like a pretty solid build to me.

If i'm reading documentation right it seems like you're not exposing SQLite to the "user", it'd be a really dope feature to include that freedom.

Then "users" could create their own tables programmatically and fill them with data they gather while the bot is running (probably not very useful though) and could also query for anything they find useful =)

I definitely like this idea.

 

EXTRA:
Idk if there's a gearscore addon for 2.4.3, but it'd be real dope to implement one of those into the lib (along with items), this way we could determine what item's players should be equipped with according to magic formulas =)

 

Do you guys hang around some IRC, Discord or Slack maybe? Would be cool to ball ideas around with you guys =)

Link to comment
Share on other sites

Don't bother with manacost. You can generally estimate the mana percentage it costs and see if you're above. For everything IsUsableSpell covers what you need.

Most of us hang around the wRobot Discord. The link is in sidebar/footer iirc, but just in case: https://discord.gg/ED2Mjfp

And there is a gearscore addon for 2.4.3. It's absolutely useless bullshit though, especially on lower levels. TBC isn't Wrath, itemization works very differently and the guy who backported it did it to troll Feenix. Only the Warmane community was actually stupid enough to pick it up and use it.
Pawn uses actual, real stat weights.

Link to comment
Share on other sites

13 hours ago, Matenia said:

Don't bother with manacost. You can generally estimate the mana percentage it costs and see if you're above. For everything IsUsableSpell covers what you need.

Most of us hang around the wRobot Discord. The link is in sidebar/footer iirc, but just in case: https://discord.gg/ED2Mjfp

And there is a gearscore addon for 2.4.3. It's absolutely useless bullshit though, especially on lower levels. TBC isn't Wrath, itemization works very differently and the guy who backported it did it to troll Feenix. Only the Warmane community was actually stupid enough to pick it up and use it.
Pawn uses actual, real stat weights.

I'm doing this for the lolz though, and possibly make a good opensource system for others to build fightclasses on.

I've already managed to get the exact manacost from spells with a set manacost, but spells such as Cat Form use % of base mana, and getting base mana is rather impossible afaik (so i'll have to use data from TBC-DB)

I used to do hacky custom systems for private servers but i've grown rather tired of it. So i thought i'll be hobbycoding some here instead :)

Thanks for the info about Pawn btw, will be useful! :)

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