Пример #1
0
        public void Text(dynamic txt, float x1, float y1, float z1, float size, Color color, int alpha = 255, FontFamily font = null)
        {
            var s   = txt.ToString();
            var pos = new Vector3(x1, y1, z1);

            Radar3D.DrawString(s, pos, size, color, alpha, font);
        }
Пример #2
0
        public void Line(float x1, float y1, float z1, float x2, float y2, float z2, Color color, int alpha = 255)
        {
            var from = new Vector3(x1, y1, z1);
            var to   = new Vector3(x2, y2, z2);

            Radar3D.DrawLine(from, to, color, alpha);
        }
Пример #3
0
    public void Dispose()
    {
        LuaEnv.CallFunctionSafe("onStop");

        Radar3D.Stop();

        Logging.Write("[LuaPlugin] Disposed.");
    }
Пример #4
0
        /// <summary>
        /// Loads an Lua script
        /// </summary>
        /// <param name="path">Path to the script</param>
        public static void LoadScript(string path)
        {
            try
            {
                UserData.RegisterAssembly();

                UserData.RegisterType <Spell>();
                UserData.RegisterType <WoWLocalPlayer>();
                UserData.RegisterType <WoWPlayer>();
                UserData.RegisterType <WoWUnit>();
                UserData.RegisterType <SpellManager>();

                UserData.RegisterType <Vector3>();
                UserData.RegisterType <Color>();
                UserData.RegisterType <CancelEventArgs>();

                Script = new Script(CoreModules.Preset_SoftSandbox | CoreModules.LoadMethods)
                {
                    Options =
                    {
                        CheckThreadAccess = false,
                        DebugPrint        = Logging.Write
                    }
                };

                Script.Globals["objectManager"] = new ObjectManagerApi();
                Script.Globals["spellManager"]  = UserData.Create(typeof(SpellManager));
                Script.Globals["spell"]         = UserData.Create(typeof(Spell));
                Script.Globals["color"]         = UserData.Create(typeof(Color));
                Script.Globals["game"]          = new GameApi();
                Script.Globals["draw"]          = new DrawApi();

                IsLuaEnvActive = true;

                try
                {
                    Script.DoFile(path);
                    IsScriptLoaded = true;
                    CallFunctionSafe("onStart");

                    //Fight Callbacks
                    FightEvents.OnFightLoop  += OnFightLoop;
                    FightEvents.OnFightStart += OnFightStart;
                    FightEvents.OnFightEnd   += OnFightEnd;
                    //Draw Callbacks
                    Radar3D.Pulse();
                    Radar3D.OnDrawEvent += OnDraw;
                }
                catch (InterpreterException ex)
                {
                    Logging.WriteError(ex.DecoratedMessage);
                }
            }
            catch (Exception ex)
            {
                Logging.WriteError("Error Setting up Lua Environment: " + ex.Message);
            }
        }
Пример #5
0
 // Singleton pattern
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
     }
 }
Пример #6
0
    // Create a 3D icon for this tracked object
    private void InstantiateTrackedIcon()
    {
        Radar3D radar = Radar3D.Instance;

        if (radar != null)
        {
            GameObject newIcon3D = Instantiate(icon3DPrefab, radar.transform);
            gameObject.name = "Traffic Vehicle " + id.ToString();
            newIcon3D.name  = "Traffic Vehicle Icon " + id.ToString();
            newIcon3D.GetComponentInChildren <Text>().text = id.ToString();
            radar.Add3DIcon(id, newIcon3D);
            thisId = id;
            id++;
        }
    }
Пример #7
0
        public void Text(dynamic txt, Vector3 pos, float size, Color color, int alpha = 255, FontFamily font = null)
        {
            var s = txt.ToString();

            Radar3D.DrawString(s, pos, size, color, alpha, font);
        }
Пример #8
0
        public void Circle(float x1, float y1, float z1, float radius, Color color, bool filled = false, int alpha = 255)
        {
            var center = new Vector3(x1, y1, z1);

            Radar3D.DrawCircle(center, radius, color, filled, alpha);
        }
Пример #9
0
 public void Circle(Vector3 center, float radius, Color color, bool filled = false, int alpha = 255)
 {
     Radar3D.DrawCircle(center, radius, color, filled, alpha);
 }
Пример #10
0
 public void Line(Vector3 from, Vector3 to, Color color, int alpha = 255)
 {
     Radar3D.DrawLine(from, to, color, alpha);
 }
Пример #11
0
 void OnEnable()
 {
     radar = GameObject.FindGameObjectWithTag ("Radar3D").GetComponent<Radar3D> ();
     radius = gameObject.GetComponent<SphereCollider> ().radius;
 }
Пример #12
0
    public static void Initialize()
    {
        Main.Log("Initialized");
        _petPulseThread.DoWork += PetThread;
        _petPulseThread.RunWorkerAsync();
        ZEBMHunterSettings.Load();
        _settings = ZEBMHunterSettings.CurrentSetting;
        Talents.InitTalents(_settings.AssignTalents, _settings.UseDefaultTalents, _settings.TalentCodes);

        // Set Steady Shot delay
        if (_settings.RangedWeaponSpeed > 2000)
        {
            _steadyShotSleep = _settings.RangedWeaponSpeed - 1600;
        }
        else
        {
            _steadyShotSleep = 500;
        }
        Main.LogDebug("Steady Shot delay set to : " + _steadyShotSleep.ToString() + "ms");

        FightEvents.OnFightStart += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            if (ObjectManager.Target.GetDistance >= 13f && !AutoShot.IsSpellUsable && !_isBackingUp)
            {
                _canOnlyMelee = true;
            }
            else
            {
                _canOnlyMelee = false;
            }
        };

        FightEvents.OnFightEnd += (ulong guid) =>
        {
            _isBackingUp       = false;
            _backupAttempts    = 0;
            _autoshotRepeating = false;
            _canOnlyMelee      = false;
        };

        Radar3D.OnDrawEvent += () =>
        {
            if (ObjectManager.Me.TargetObject != null)
            {
                Radar3D.DrawCircle(ToolBox.BackofVector3(Me.Position, Me, 20f), 1f, Color.Cyan);
            }
        };

        FightEvents.OnFightLoop += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            if (ObjectManager.Target.GetDistance < 13f && ObjectManager.Target.IsTargetingMyPet && _backupAttempts < _settings.MaxBackupAttempts &&
                !MovementManager.InMovement && Me.IsAlive && !ObjectManager.Pet.HaveBuff("Pacifying Dust") && !_canOnlyMelee &&
                !ObjectManager.Pet.IsStunned && !_isBackingUp && !Me.IsCast && _settings.BackupFromMelee)
            {
                _isBackingUp = true;
                var pos = 1;
                if (ObjectManager.Me.IsAlive && ObjectManager.Target.IsAlive && pos == 1)
                {
                    Vector3 position = ToolBox.BackofVector3(Me.Position, Me, 20f);
                    MovementManager.Go(PathFinder.FindPath(position), false);

                    while (MovementManager.InMovement && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           ObjectManager.Target.GetDistance < 13f && _backupAttempts < _settings.MaxBackupAttempts && !_canOnlyMelee)
                    {
                        // Wait follow path
                        Thread.Sleep(2000);
                        pos = 0;
                        _backupAttempts++;
                    }
                }
                ReenableAutoshot();
                Main.LogDebug("Backup attempt : " + _backupAttempts);
                _isBackingUp = false;
                if (_backupAttempts >= _settings.MaxBackupAttempts)
                {
                    _canOnlyMelee = true;
                }
            }
        };

        Rotation();
    }