PierreDeRosette 13 Posted August 13, 2014 Share Posted August 13, 2014 Hello I made a first version. It's looks like ok but there is a little surprise : Wathever i choose On or Off, Manage rotation.... in Wrotation looks always on. Each time i get a target, the character run to it.... not what i want... (also perhaps you can improve my code :) not yet added rotation, only the targetting) Here is my used code : using System; using System.Threading; using System.Windows.Forms; using robotManager.Helpful; using Timer = robotManager.Helpful.Timer; using wManager.Wow.Class; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; using Point = System.Drawing.Point; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; public class Main : ICustomClass { public float Range { get { return 40; } } private bool _loop; #region Spells public readonly Spell IceLance = new Spell("Ice Lance"); #endregion Spells private Timer _Resume = new Timer(0); public void Initialize() { Logging.Write("Chargement Mage Glace PVP"); List<WoWPlayer> enemyPlayerList; UInt64 lastTarget = 0; _loop = true; while (_loop) { try { enemyPlayerList = ObjectManager.GetWoWUnitHorde(); WoWPlayer[] Cibles = new WoWPlayer[enemyPlayerList.Count]; long[] CiblePV = new long[enemyPlayerList.Count]; int offset = 0; foreach (WoWPlayer adversaire in enemyPlayerList) { Cibles[offset] = adversaire; CiblePV[offset] = adversaire.Health; offset++; } Array.Sort(CiblePV, Cibles); for (int x = 0; x < enemyPlayerList.Count; x++) { if (Cibles[x].GetDistance < 150 && Cibles[x].IsValid && Cibles[x].IsAlive) { Interact.InteractGameObject(Cibles[x].GetBaseAddress); if (ObjectManager.Me.Target == Cibles[x].Guid) { Rotation(); } } } if (_Resume.IsReady) { for (int x = 0; x < enemyPlayerList.Count; x++) { Logging.Write(x + "e Joueur " + Cibles[x].Name + " = " + CiblePV[x] + " Dist " + Cibles[x].GetDistance); } _Resume = new Timer(5000); } } catch (Exception e) { Logging.WriteError("CustomClass > Initialize(): " + e); } Thread.Sleep(15); } _loop = false; } public void Rotation() { } public void Dispose() { Logging.Write("Dispose Fight Class Heal"); _loop = false; } public void ShowConfiguration() { MessageBox.Show("Script pour Moine heal : Mauvaise classe"); } } Link to comment https://wrobot.eu/forums/topic/1550-manage-rotation-range-bugged/ Share on other sites More sharing options...
Droidz 2738 Posted August 14, 2014 Share Posted August 14, 2014 Hello, Use an Fightclass is not a good way to manage target at attack. It is more recommended to make an "Custom Profile" or the best is to make an "Product" (bot) (you can activate option "Dont Start Fighting" in general settings but I recommand to not use Fightclass for this). I have make sample of custom class with your code (if this works like you want say me it I'll give code to join queue and enter in bg) (you can after use this code with small edit to make product dll): using System; using System.Collections.Generic; using System.Linq; using robotManager.FiniteStateMachine; using robotManager.Helpful; using robotManager.Products; using wManager; using wManager.Wow.Bot.States; using wManager.Wow.Enums; using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; public class CustomProfile : Custom_Profile.ICustomProfile { private static readonly Engine Fsm = new Engine(); // Start custom profile public void Pulse() { try { // Update spell list SpellManager.UpdateSpellBook(); // Load CC: wManager.Wow.Helpers.CustomClass.LoadCustomClass(); // FSM : http://en.wikipedia.org/wiki/Finite-state_machine Fsm.States.Clear(); Fsm.AddState(new wManager.Wow.Bot.States.Relogger { Priority = 200 }); // Relog if disconnected Fsm.AddState(new wManager.Wow.Bot.States.Pause { Priority = 13 }); // Manage bot pause Fsm.AddState(new wManager.Wow.Bot.States.ResurrectBG { Priority = 12 }); // Resurrect player (bg mode) Fsm.AddState(new wManager.Wow.Bot.States.Resurrect { Priority = 12 }); // Resurrect player (b=normal mode) Fsm.AddState(new wManager.Wow.Bot.States.MyMacro { Priority = 11 }); // Manage MyMacro (user settings in general settings) Fsm.AddState(new wManager.Wow.Bot.States.FarmingBG { Priority = 10 }); // Farm in BG (for flag, door, ...) Fsm.AddState(new ManageTargetBG { Priority = 9, DistanceSearch = 150 }); // Search target at attacked (THIS CLASS IS AT TGE END OF THIS PAGE) //Fsm.AddState(new wManager.Wow.Bot.States.GrindingBG { Priority = 9, DistanceSearch = 150 }); // Search target at attacked Fsm.AddState(new wManager.Wow.Bot.States.IsAttacked { Priority = 8 }); // Launch combat if player attacked //Fsm.AddState(new wManager.Wow.Bot.States.Regeneration {Priority = 8}); // Regen health/mana //Fsm.AddState(new wManager.Wow.Bot.States.Looting { Priority = 7 }); // Loot npc dead //Fsm.AddState(new wManager.Wow.Bot.States.Farming { Priority = 6 }); // farm mines/herbs/... Fsm.AddState(new wManager.Wow.Bot.States.AntiAfk { Priority = 5 }); // Anti AFK Fsm.AddState(new wManager.Wow.Bot.States.Idle { Priority = 0 }); // If not states need to run, wait Fsm.States.Sort(); // Order states by Prority Fsm.StartEngine(10, "_customProfile"); // Launch FSN (with all added states) StopBotIf.LaunchNewThread(); // Launch bot security (tab "security" in general settings) // Attach onlevelup for spell book: EventsLua.AttachEventLua(LuaEventsId.PLAYER_LEVEL_UP, m => OnLevelUp()); // Follow lua event for get when player level up // Move during combat: //FightBG.MoveDuringCombat = true; Logging.Write("Custom Profile Started."); } catch (Exception e) { try { Dispose(); } catch { } Logging.WriteError("Bot > Pulse(): " + e); } } // Stop custom profile public void Dispose() { try { wManager.Wow.Helpers.CustomClass.DisposeCustomClass(); Fsm.StopEngine(); Fight.StopFight(); MovementManager.StopMove(); } catch (Exception e) { Logging.WriteError("Bot > Dispose(): " + e); } } // When player levelup void OnLevelUp() { Logging.Write("Level UP! Reload Fight Class."); // Update spell list SpellManager.UpdateSpellBook(); // Load CC: wManager.Wow.Helpers.CustomClass.ResetCustomClass(); } // Fsm state to manage target at attack public class ManageTargetBG : State { public override string DisplayName { get { return "Manage target BG"; } } public override int Priority { get { return _priority; } set { _priority = value; } } private int _priority; public override List<State> NextStates { get { return new List<State>(); } } public override List<State> BeforeStates { get { return new List<State>(); } } public List<int> EntryTarget = new List<int>(); public List<uint> FactionsTarget = new List<uint>(); public float DistanceSearch = 150; private WoWUnit _unit; // If this method return true, wrobot launch method Run(), if return false wrobot go to next state in FSM public override bool NeedToRun { get { if (wManagerSetting.CurrentSetting.DontStartFighting) return false; if (!Battleground.IsInBattleground() || !Battleground.BattlegroundIsStarted()) // Not run is not in bg return false; if (!Usefuls.InGame || Usefuls.IsLoadingOrConnecting || ObjectManager.Me.IsDeadMe || !ObjectManager.Me.IsValid || !Products.IsStarted) return false; // Get unit: _unit = new WoWUnit(0); var enemyPlayerList = new List<WoWUnit>(); if (FactionsTarget.Count > 0) enemyPlayerList.AddRange(ObjectManager.GetWoWUnitByFaction(FactionsTarget)); if (EntryTarget.Count > 0) enemyPlayerList.AddRange(ObjectManager.GetWoWUnitByEntry(EntryTarget)); if (ObjectManager.Me.PlayerFaction == "Alliance") enemyPlayerList.AddRange(ObjectManager.GetWoWUnitHorde()); if (ObjectManager.Me.PlayerFaction == "Horde") enemyPlayerList.AddRange(ObjectManager.GetWoWUnitAlliance()); // Your code WoWUnit[] cibles = new WoWUnit[enemyPlayerList.Count]; long[] ciblePv = new long[enemyPlayerList.Count]; int offset = 0; foreach (WoWUnit adversaire in enemyPlayerList) { cibles[offset] = adversaire; ciblePv[offset] = adversaire.Health; offset++; } Array.Sort(ciblePv, cibles); // You can replace your code to sort players by: // cibles = enemyPlayerList.OrderBy(p => p.Health).ToArray(); // And I think it is more appropriate to use HealthPercent instead Health for (int x = 0; x < enemyPlayerList.Count; x++) { if (cibles[x].IsValid && cibles[x].GetDistance < DistanceSearch && cibles[x].IsAlive && _unit.SummonedBy <= 0 && // Avoid pet _unit.Guid != ObjectManager.Pet.Guid && !wManagerSetting.IsBlackListedAllConditions(_unit)) // Check if blacklisted { bool result; PathFinder.FindPath(_unit.Position, out result); // Test if wrobot can make path to the target to avoid stuck if (result) { _unit = cibles[x]; return true; } } } _unit = new WoWUnit(0); return false; } } // If NeedToRun() == true public override void Run() { if (!_unit.IsValid) return; Logging.Write("Player Attack " + _unit.Name + " (lvl " + _unit.Level + ")"); FightBG.StartFight(_unit.Guid); // Launch Fight if (_unit.IsDead) { Statistics.Kills++; } FightBG.StopFight(); } } } ps: I haven't time to test it now, tell me if this don't works, save this file in "WRobot\Profiles\Custom Profile\" (.cs file) and use product "Custom Product). PierreDeRosette and happiness7 1 1 Link to comment https://wrobot.eu/forums/topic/1550-manage-rotation-range-bugged/#findComment-7980 Share on other sites More sharing options...
PierreDeRosette 13 Posted August 14, 2014 Author Share Posted August 14, 2014 Hi The code that you provided is a treasure of new functions and possibilities. But also some others questions appear : 1/ If i use it like a custom class, i put it in folder custom profile, and choose it at "Product settings". But what i'm supposed to load in General settings-Fight class ? 2/ Shall i use a basic file with spells details and rotation attacks with their conditions (without targetting features of course )? 3/ It's a bug or a mistake of my part when the character always run to the target when he get a target (whatever i choose On or Off in Manage character rotation under Wrotation) 4/ Can i do something to avoid getting character running to the target with custom class features (and wrotation) ? I want absolutely keep my total movement control. And like that i can't use it. (Tryed this night ... Totally inusable for me. I can't get control of my movements) 5/ When you created Custom class features, what did you aiming ? A bot doing BG when BG up and farming when BG down ? Or something like that ? I've just discovered The custom class and many new features came with it. There is not enough documentation. Ps : Je suis vraiment impressionné par ta maitrise du codage et la rapidite a laquelle tu pond tes solutions :) Link to comment https://wrobot.eu/forums/topic/1550-manage-rotation-range-bugged/#findComment-7981 Share on other sites More sharing options...
Droidz 2738 Posted August 15, 2014 Share Posted August 15, 2014 1/ If i use it like a custom class, i put it in folder custom profile, and choose it at "Product settings". But what i'm supposed to load in General settings-Fight class ? You can load normal fightclass. 2/ Shall i use a basic file with spells details and rotation attacks with their conditions (without targetting features of course )? You talk about Fightclass? if yes, yes fightclass is only for manage spells rotation (you can stop fight (FightBG.StopFight() ;) but you are limited (WRobot manage automatically target, if you change target WRobot select again last target). 3/ It's a bug or a mistake of my part when the character always run to the target when he get a target (whatever i choose On or Off in Manage character rotation under Wrotation) I'll reply here: http://wrobot.eu/page/bug_tracker.html/_/wrotation-le-bouton-de-management-de-distance-nest-pas-pris-en-compte-r241 4/ Can i do something to avoid getting character running to the target with custom class features (and wrotation) ? I want absolutely keep my total movement control. And like that i can't use it. (Tryed this night ... Totally inusable for me. I can't get control of my movements) You can stop fight: "FightBG.StopFight();" 5/ When you created Custom class features, what did you aiming ? A bot doing BG when BG up and farming when BG down ? Or something like that ? Custom class or Custom Profile? if custom profile, I have make it to create quickly small bot (produit) with access at wrobot api without need compilation. If fightclass I have make it to manage spells/items during/out combat. I've just discovered The custom class and many new features came with it. There is not enough documentation. Yes, he has not documentation and I don't think write this soon, few people use wrobot api yet. Ps : Je suis vraiment impressionné par ta maitrise du codage et la rapidite a laquelle tu pond tes solutions :) Merci. Link to comment https://wrobot.eu/forums/topic/1550-manage-rotation-range-bugged/#findComment-7983 Share on other sites More sharing options...
PierreDeRosette 13 Posted August 15, 2014 Author Share Posted August 15, 2014 Tu a raison C'est : Interact.InteractGameObject(); Qui provoque le mouvement, alors que c'est pas censé le faire :( Merci pour ta reponse Link to comment https://wrobot.eu/forums/topic/1550-manage-rotation-range-bugged/#findComment-7984 Share on other sites More sharing options...
Droidz 2738 Posted August 15, 2014 Share Posted August 15, 2014 Essaye ça: Interact.InteractGameObject(wowUnit.GetBaseAddress, !ObjectManager.Me.GetMove); Link to comment https://wrobot.eu/forums/topic/1550-manage-rotation-range-bugged/#findComment-7985 Share on other sites More sharing options...
PierreDeRosette 13 Posted August 15, 2014 Author Share Posted August 15, 2014 Premiers tests et ca semble nickel... bravo !!! Link to comment https://wrobot.eu/forums/topic/1550-manage-rotation-range-bugged/#findComment-7987 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now