What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

Cast on item...

AutomaticCoding

New Member
Joined
Dec 20, 2011
Messages
1,091
Reaction score
1
Code:
                while (InbagCount(obsidiumOre) >= 5)
                {
                    Styx.Logic.Combat.WoWSpell spell = Styx.Logic.Combat.WoWSpell.FromId(prospectSpell);
                    if (spell.CanCast)
                    {
                        //What do I do?
                    }
                }

I know I can do:
Spell.cast();
Lua.DoString("UseContainerItem({0}, {1})", blah, blah);

Or do it 100% in lua, but, I'd prefer to use the HB API so if it needs updating then it'll be updated by the HB team.

EDIT: Got mad, looked up on ProfessionBuddy, they use:

Code:
                            WoWSpell spell = WoWSpell.FromId(SpellId);
                            if (spell != null)
                            {
                                TreeRoot.GoalText = string.Format("{0}: {1}", ActionType, itemList[index].Name);
                                Professionbuddy.Log(TreeRoot.GoalText);
                                //Lua.DoString("CastSpellByID({0}) UseContainerItem({1}, {2})",
                                //    spellId, ItemList[index].BagIndex + 1, ItemList[index].BagSlot + 1);
                                spell.CastOnItem(itemList[index]);
                                _lastItemGuid = itemList[index].Guid;
                                _lastStackSize = itemList[index].StackCount;
                                _castTimer.Reset();
                                _castTimer.Start();
                            }
                            else
                                IsDone = true;

Which is:
Code:
spell.CastOnItem(itemList[index]);

But mine throws:

Code:
if (spell.CanCast)
                    {
                        spell.CastOnItem(obsidiumOre);
                    }
Code:
Error	1	'Styx.Logic.Combat.WoWSpell' does not contain a definition for 'CastOnItem' and no extension method 'CastOnItem' accepting a first argument of type 'Styx.Logic.Combat.WoWSpell' could be found (are you missing a using directive or an assembly reference?)	D:\HB\Bots\AuctionBuddy\AuctionBuddy\Professions.cs	104	31	AuctionBuddy
 
Last edited:
Back
Top