Jump to content

Recommended Posts

Hi there,

I have lots of experience in writing entire combat scripts in LUA, is it possible to do that with WRobot?

If I use the FightClass editor and call my script "Warlock" for example, can I then put an entire rotation in LUA and use the "Not spell, is lua script" option?

If so, is there a "template" or wrapper I should be using as a base for the rotations?

Many thanks

Ofrex35

Link to comment
https://wrobot.eu/forums/topic/15550-entire-fight-class-in-lua/
Share on other sites

Hello,

Yes you can  use fightclass editor with the option "Not spell, is lua script" with timer option to avoid spamming lua commands.

 

Or you can use C# fightclass (sample of structure) :

using System;
   using System.Threading;
   using System.Windows.Forms;
   using robotManager.Helpful;
   using wManager.Wow.Helpers;
   using wManager.Wow.ObjectManager;

   public class Main : ICustomClass
   {
       public float Range { get { return 4.5f; } }

       private bool _isLaunched;
       private ulong _lastTarget;

       public void Initialize()
       {
           _isLaunched = true;
           Logging.Write("[My fightclass] Is initialized.");
           Rotation();
       }

       public void Dispose()
       {
           _isLaunched = false;
           Logging.Write("[My fightclass] Stop in progress.");
       }

       public void ShowConfiguration()
       {
           MessageBox.Show("[My fightclass] No setting for this Fight Class.");
       }


       internal void Rotation()
       {
           Logging.Write("[My fightclass] Is started.");
           while (_isLaunched)
           {
               try
               {
                   if (Conditions.InGameAndConnectedAndProductStartedNotInPause)
                   {
                       if (ObjectManager.Me.IsAlive)
                       {
                           if (Fight.InFight &&
                               ObjectManager.Me.Target.IsNotZero())
                           {
                               OneTimePerCombatTasks();
                               CombatTasks();
                           }
                           else
                           {
                               OutOfCombatTasks();
                           }
                       }
                   }
               }
               catch (Exception e)
               {
                   Logging.WriteError("[My fightclass] ERROR: " + e);
               }

               Thread.Sleep(250); // Pause to reduce the CPU usage, you can increment sleep time.
           }
           Logging.Write("[My fightclass] Is now stopped.");
       }

       internal void OutOfCombatTasks()
       {
           if (ObjectManager.Me.IsMounted)
               return;
           
           Lua.LuaDoString(@"

--[[ Your Lua code here ]]--
print('Out of combat tasks');

        ");
           
       }
       internal void OneTimePerCombatTasks()
       {
           if (ObjectManager.Me.Target == _lastTarget)
               return;
           _lastTarget = ObjectManager.Me.Target;
           
           Lua.LuaDoString(@"

--[[ Your Lua code here ]]--
print('One time per combat tasks');

        ");
       }

       internal void CombatTasks()
       {
           Lua.LuaDoString(@"

--[[ Your Lua code here ]]--
print('Combat tasks');

        ");
       }
   }

 

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