Jump to content

Apexx

Elite user
  • Posts

    332
  • Joined

Reputation Activity

  1. Thanks
    Apexx reacted to Matenia in Alot of questions about FightClass and API   
    Yeah, the error message is very clear. Count is a property, you cannot call it like a method (such as "Count(args...)").
    if (ObjectManager.GetUnitAttackPlayer().Where(u => u.GetDistance <= 6).ToList().Count > 2) Should do the trick
  2. Like
    Apexx got a reaction from Droidz in Hunter Class - Auto Shot and Attack Interrupt Issue   
    Okay @Droidz, that is really strange, but it seems to work! Thank you!
  3. Thanks
    Apexx reacted to Droidz in Hunter Class - Auto Shot and Attack Interrupt Issue   
    try to enable it
  4. Sad
    Apexx got a reaction from Avvi in Hunter Class - Auto Shot and Attack Interrupt Issue   
    I just checked it and switched to off. Still Auto Attack.
  5. Like
    Apexx got a reaction from Avvi in Hunter Class - Auto Shot and Attack Interrupt Issue   
    It does not look nearly as bad, but it is a bit of an issue in my honest opinion. Thanks again @Avvi
  6. Thanks
    Apexx reacted to Avvi in Hunter Class - Auto Shot and Attack Interrupt Issue   
    Sweet. I'm glad we found a workaround for this!
  7. Like
    Apexx got a reaction from Avvi in Hunter Class - Auto Shot and Attack Interrupt Issue   
    Yeah I have done that for now. hah!
  8. Like
    Apexx reacted to Avvi in Hunter Class - Auto Shot and Attack Interrupt Issue   
    My code is working in Legion for me. This is exactly what i have: 
    private void watchForEvents() { EventsLuaWithArgs.OnEventsLuaWithArgs += (LuaEventsId id, List<string> args) => { if (id == wManager.Wow.Enums.LuaEventsId.PLAYER_ENTER_COMBAT) { Logging.Write("AUTO ATTACK ENABLED."); } }; }  
    I can spam the "Auto-Attack" button, and it spams the AUTO ATTACK ENABLED. Or, when the character enables it himself, it also logs the AUTO ATTACK ENABLED
  9. Confused
    Apexx got a reaction from Avvi in Hunter Class - Auto Shot and Attack Interrupt Issue   
    Yes I did.
  10. Thanks
    Apexx got a reaction from Findeh in Alot of questions about FightClass and API   
    // Return Number of Hostile Units Attacking in Specified Range private int HostileUnitsInRange(float range) { int hostileUnitsInRange = ObjectManager.GetUnitAttackPlayer().Count(u => u.GetDistance <= range); return hostileUnitsInRange; } Try something like the following (Will check if no unit is attacking you within 30 yards):
    wManager.Events.FightEvents.OnFightEnd += delegate { if (HostileUnitsInRange(30) == 0) Buff(); };  
  11. Thanks
    Apexx reacted to Avvi in Check If in Group/Party and Party Member Online   
    Hey Apexx, I believe I had a typo in the code snippet. Please try again.  with this 
    var isConnected = Lua.LuaDoString<bool>("return UnitIsConnected('" + "member.Name" + "')");
  12. Thanks
    Apexx reacted to Avvi in Is Target Player of Opposite Faction   
    Just to clarify, the try / catch will prevent the bot from crashing, and then return the issue to WRobot logs. I use this technique when testing/trying to fix issues in my code all the time :) 
  13. Thanks
    Apexx reacted to reapler in Is Target Player of Opposite Faction   
    If this happens you should consider to use try and catch to log the error:
    try { // Buff Friendly Targets if (PriestSettings.CurrentSetting.BuffFriendlyTargets) { if (_powerWordFortitude.KnownSpell && _powerWordFortitude.IsSpellUsable && target.Faction == player.Faction && target.IsAlive && target.IsValid && target.GetDistance <= _powerWordFortitude.MaxRange && !TraceLine.TraceLineGo(target.Position) && !target.HaveBuff(_powerWordFortitude.Ids)) { Logging.WriteDebug(target.Name + " is missing Power Word: Fortitude."); _powerWordFortitude.Launch(); Thread.Sleep(SpellManager.GetSpellCooldownTimeLeft(_powerWordFortitude.Id)); } } } catch (Exception e) { Logging.WriteError(e.ToString()); } For example you haven't initialized "PriestSettings.CurrentSetting", so this would result in null and throw an exception.
  14. Thanks
    Apexx reacted to Droidz in I love the 3d radar, but..   
  15. Thanks
    Apexx reacted to reapler in Is Target Player of Opposite Faction   
    Hello, ".PlayerFaction" should do its job:
    if (ObjectManager.Me.PlayerFaction == ((WoWPlayer) ObjectManager.Target).PlayerFaction) { Logging.Write("target same faction"); } if (ObjectManager.Me.PlayerFaction != ((WoWPlayer) ObjectManager.Target).PlayerFaction) { Logging.Write("target hostile faction"); } To check if target is a player:
    ObjectManager.Target.PlayerControlled
  16. Thanks
    Apexx reacted to Avvi in Check If in Group/Party and Party Member Online   
    if (Party.IsInGroup()) { // in group var partyMembers = wManager.Wow.Helpers.Party.GetParty foreach (var member in partyMembers) { // UnitIsConnected("unit") var isConnected = Lua.LuaDoString<bool>("return UnitIsConnected('" + "member.Name" + "')"); if (isConnected) { Logging.Write("Player " + member.Name + " is online."); } } } else{ // not in group } The above will check if you are in a group and then tell you whether each party member is online/not online.
  17. Thanks
    Apexx got a reaction from Findeh in Heals Casting Twice With Timer   
    Timer Declaration
    public static Timer waitTime = new Timer(); Asynchronous Task UseCombatSpell
    public static async Task<bool> UseCombatSpell(Spell spell, bool stopMoving, bool faceTarget = false, float rangeCheck = float.MaxValue, int castWait = 0) { // Spell validation if (Methods.IsValid(MyTarget, spell)) { // Launch the spell if (!Me.IsCast && waitTime.IsReady) { // Face the target if (faceTarget) MovementManager.Face(Me.TargetObject); Interact.InteractGameObject(MyTarget.GetBaseAddress, stopMoving); SpellManager.CastSpellByNameLUA(spell.Name); // Wait for cooldown + latency await Task.Delay(SpellManager.GetSpellCooldownTimeLeft(spell.Id) + Usefuls.Latency); // Create a new timer for the desired wait time between casts. waitTime = new Timer(castWait); Methods.LogFight("Wait time = " + waitTime.TimeLeft()); return true; } return false; } return false; } Please note, that I removed the rangeCheck portion of code from the above method.

    Usage:
    if (await Abilities.LesserHeal()) return true; // Lesser Heal
    Methods.IsValid is basically making sure that the player knowns the spell, that the spell is usable and in good distance, 
    that the player is not eating or drinking, or is mounted..
    That the target is attackable and alive, in distance, and in line of sight etc..

    Abilities.Spellname is from a custom class of loading and declaring the class spells.
  18. Like
    Apexx got a reaction from morris79 in Wand Use & IsAutoRepeatAction(slot)   
    For anyone having issues with using the Wand Shoot ability, here is a snippet for you:
    // Test if player has a wand in the proper equipment slot | In Combat if (ObjectManager.Me.GetEquipedItemBySlot(wManager.Wow.Enums.InventorySlot.INVSLOT_RANGED) != 0 && ObjectManager.Me.InCombat && !ObjectManager.Me.GetMove) { // Wand Shoot if(Lua.LuaDoString<int>("isAutoRepeat = \"\"; isAutoRepeat = 0; local name = GetSpellInfo(5019); if IsAutoRepeatSpell(name) then isAutoRepeat = 1 end", "isAutoRepeat") == 0) { // Spammable Shoot Macro Lua.RunMacroText("/castsequence !Shoot, !Shoot"); } }  
  19. Like
    Apexx reacted to reapler in Check If Target Has a Weapon   
    Well, you can use these methods to check your unit:
    /// <summary> /// Used to get the main hand weapon of an unit. /// </summary> /// <remarks>Using 3.3.5a(12340) offsets.</remarks> /// <param name="unit">The unit.</param> public int MainHandId(WoWUnit unit) { if (unit.PlayerControlled) return wManager.Wow.Memory.WowMemory.Memory.ReadInt32(unit.GetDescriptorAddress(0x4E4)); return wManager.Wow.Memory.WowMemory.Memory.ReadInt32(unit.GetDescriptorAddress(0xE0)); } public bool IsDisarmed(WoWUnit unit) { return unit.UnitFlags.HasFlag(UnitFlags.Disarmed); } public bool IsHumanoid(WoWUnit unit) { return unit.CreatureTypeTarget == "Humanoid"; } As you can see you need for the main hand id different offsets, which are for wotlk(maybe it works for other expansions).
    Please note that the id will still be returned for player characters even when shapeshifted or disarmed. If a npc / player doesn't carry a weapon, it will be zero.
    I think it should suffice to build a properly check for disarm.
  20. Thanks
    Apexx got a reaction from Photogenic in Wand Use & IsAutoRepeatAction(slot)   
    For anyone having issues with using the Wand Shoot ability, here is a snippet for you:
    // Test if player has a wand in the proper equipment slot | In Combat if (ObjectManager.Me.GetEquipedItemBySlot(wManager.Wow.Enums.InventorySlot.INVSLOT_RANGED) != 0 && ObjectManager.Me.InCombat && !ObjectManager.Me.GetMove) { // Wand Shoot if(Lua.LuaDoString<int>("isAutoRepeat = \"\"; isAutoRepeat = 0; local name = GetSpellInfo(5019); if IsAutoRepeatSpell(name) then isAutoRepeat = 1 end", "isAutoRepeat") == 0) { // Spammable Shoot Macro Lua.RunMacroText("/castsequence !Shoot, !Shoot"); } }  
  21. Like
    Apexx reacted to reapler in Heals Casting Twice With Timer   
    Hello, i've created a small example for this, everything else is explained in the comments:
    using System; using System.Collections.Generic; using System.Threading; using wManager.Plugin; using wManager.Wow.Class; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; using static robotManager.Helpful.Logging; public class Main : IPlugin { #region Variables private bool _isLaunched; private int _msDelay = 200; private DateTime _unlockTime = DateTime.Now; private readonly HashSet<string> _noGcdSpells = new HashSet<string> { "Counterspell", //... //http://wowwiki.wikia.com/wiki/Cooldown => Abilities noted for not affecting nor being affected by the global cooldown: }; #endregion #region Properties public bool GcdActive => DateTime.Now < _unlockTime; #endregion #region WRobot Interface public void Initialize() { var pGuid = ToWoWGuid(ObjectManager.Me.Guid); EventsLuaWithArgs.OnEventsLuaWithArgs += delegate(LuaEventsId id, List<string> args) { if ( id == LuaEventsId.COMBAT_LOG_EVENT_UNFILTERED && args[2] == pGuid && !_noGcdSpells.Contains(args[9]) && ( args[1] == "SPELL_CAST_SUCCESS" || args[1] == "SPELL_HEAL" || args[1] == "SPELL_DAMAGE" ) ) { Write("lock"); _unlockTime = DateTime.Now.AddMilliseconds(_msDelay); } }; _isLaunched = true; Write("Loaded"); while (_isLaunched) { try { if (Conditions.ProductIsStartedNotInPause) { Pulse(); } } catch (Exception e) { WriteError(e.ToString()); } Thread.Sleep(30); } } public void Dispose() { _isLaunched = false; } public void Settings() { } #endregion #region Pulse public void Pulse() { var spell = new Spell("Lesser Heal"); if (!GcdActive && spell.IsSpellUsable && !ObjectManager.Me.IsCast && ObjectManager.Me.TargetObject.HealthPercent <= 90 ) { spell.Launch(false, false); //will cast the heal if "_msDelay" was passed } /* if (spell.IsSpellUsable && !ObjectManager.Me.IsCast && ObjectManager.Me.TargetObject.HealthPercent <= 90) { spell.Launch(false, false); //.IsSpellUsable is true after gcd was passed but the heal itself can delay //and cause double heal cast if no additional delay is added like above //so ObjectManager.Me.TargetObject.HealthPercent <= 90 would be true for a short time }*/ } #endregion #region Methods public string ToWoWGuid(ulong guid) { var wowGuid = ObjectManager.Me.Guid.ToString("x").ToUpper(); var c = 16 - wowGuid.Length; for (var i = 0; i < c; i++) { wowGuid = "0" + wowGuid; } return "0x" + wowGuid; } #endregion } if you are going to lower the tickspeed this will rarer happens, but it can still happen. Instant spells aren't included.
  22. Like
    Apexx reacted to reapler in Buff Check - When NOT Eating OR Drinking   
    Hello, this should work:
    if ( !ObjectManager.Me.HaveBuff("Food") && !ObjectManager.Me.HaveBuff("Drink") //other conditions ) { new Spell("Battle Shout").Launch(); } But keep in mind it's not multi-language and special food needs an own check.
  23. Like
    Apexx reacted to reapler in C# WRotation - Check Product Party Healer Mode   
    @Apexx Hello, you need to add "\WRobot\Products\Party.dll" to your project references.
  24. Like
    Apexx reacted to Droidz in C# WRotation - Check Product Party Healer Mode   
    Hello,
    if (robotManager.Products.Products.ProductName.ToLower() == "party") { PartyProduct.Bot.PartySetting.Load(); if (PartyProduct.Bot.PartySetting.CurrentSetting.HealBot) { // Your code here } }  
  25. Thanks
    Apexx reacted to reapler in WoWLocalPlayer GetStance?   
    I've looked over the spell class again and found this constructor:
    public Spell(string spellNameEnglish, bool showLog) So you need to add "false" on every instance of "Spell":
    public Spell GetActiveStance() { return new Spell(Lua.LuaDoString<List<string>>(@"local r = {} for i=1,10 do local _, n, a = GetShapeshiftFormInfo(i); if a then table.insert(r, tostring(n)); end end return unpack(r);").FirstOrDefault() ?? "", false); } public Spell BattleShout = new Spell("Battle Shout", false); //...  
    This should hopefully stop the spam.
×
×
  • Create New...