Droidz 2742 Posted August 7, 2016 Share Posted August 7, 2016 Snippets C# codes for Fight Classes ps: Feel free to share your tips on this post. If your message is poorly presented or contains a question, it will be deleted. Dlarge 1 Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/ Share on other sites More sharing options...
Droidz 2742 Posted August 7, 2016 Author Share Posted August 7, 2016 Check if character/target have or not buff/debuff by spell id: Use condition type "C Sharp Code" with Value: wManager.Wow.ObjectManager.ObjectManager.Me.HaveBuff(69369) Replace "69369" by your buff/debuff ID. Replace "Me" by "Target" to check buff/debuff on current target (you can also replace "Me" by "Pet" to check on the pet). Add "!" before this code to check if not have (de)buff ( http://www.tutorialspoint.com/csharp/csharp_logical_operators.htm ). To get list of player/target (de)buff id, you can go to tab "Tools" > "Development Tools" > (if you want check your target (de)buff select npc in game) > click on "Player/target buff/debuff". stweily and Bear T.O.E. 2 Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-16508 Share on other sites More sharing options...
Droidz 2742 Posted August 7, 2016 Author Share Posted August 7, 2016 Check if character/target buff/debuff stack count by spell id: Use condition type "C Sharp Code" with Value: wManager.Wow.ObjectManager.ObjectManager.Me.BuffStack(44544) >= 1 Replace "44544" by your buff/debuff ID. Replace "Me" by "Target" to check buff/debuff on current target (you can also replace "Me" by "Pet" to check on the pet). ">= 1" check if stack count is "Bigger or Equal at 1", you can replace "1" by required stack count. You can also replace ">=" by "<=" to check if "Smaller or Equal", or by "==" to check if "Equal" - http://www.tutorialspoint.com/csharp/csharp_relational_operators.htm ). To get list of player/target (de)buff id, you can go to tab "Tools" > "Development Tools" > (if you want check your target (de)buff select npc in game) > click on "Player/target buff/debuff". Bear T.O.E. 1 Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-16509 Share on other sites More sharing options...
Droidz 2742 Posted August 7, 2016 Author Share Posted August 7, 2016 Check character/target buff/debuff time left by spell id: Use condition type "C Sharp Code" with Value: wManager.Wow.ObjectManager.ObjectManager.Me.BuffTimeLeft(new List<uint> { 69369 }) >= 1000 Replace "69369" by your buff/debuff ID. Replace "Me" by "Target" to check buff/debuff on current target (you can also replace "Me" by "Pet" to check on the pet). ">= 1000" check if time left is "Bigger or Equal at 1000 millisecond", you can replace "1000" by required time left in millisacond. You can also replace ">=" by "<=" to check if "Smaller or Equal", or by "==" to check if "Equal" - http://www.tutorialspoint.com/csharp/csharp_relational_operators.htm ). To get list of player/target (de)buff id, you can go to tab "Tools" > "Development Tools" > (if you want check your target (de)buff select npc in game) > click on "Player/target buff/debuff". Bear T.O.E. and Razzue 2 Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-16510 Share on other sites More sharing options...
DrSeltsam 0 Posted August 23, 2018 Share Posted August 23, 2018 On 8/7/2016 at 12:30 PM, Droidz said: Check character/target buff/debuff time left by spell id: Use condition type "C Sharp Code" with Value: wManager.Wow.ObjectManager.ObjectManager.Me.BuffTimeLeft(new List<uint> { 69369 }) >= 1000 Replace "69369" by your buff/debuff ID. Replace "Me" by "Target" to check buff/debuff on current target (you can also replace "Me" by "Pet" to check on the pet). ">= 1000" check if time left is "Bigger or Equal at 1000 millisecond", you can replace "1000" by required time left in millisacond. You can also replace ">=" by "<=" to check if "Smaller or Equal", or by "==" to check if "Equal" - http://www.tutorialspoint.com/csharp/csharp_relational_operators.htm ). To get list of player/target (de)buff id, you can go to tab "Tools" > "Development Tools" > (if you want check your target (de)buff select npc in game) > click on "Player/target buff/debuff". If I use this, the time left is always zero. The development Tools output also shows: PLAYER Buff/Debuff: Retribution Aura: ID=7294, Stack=1, TimeLeft=0 ms, Owner=0 Blessing of Might: ID=19834, Stack=1, TimeLeft=0 ms, Owner=0 Seal of the Crusader: ID=20162, Stack=1, TimeLeft=0 ms, Owner=0 Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-46814 Share on other sites More sharing options...
pasdoy 1 Posted August 23, 2018 Share Posted August 23, 2018 3 hours ago, DrSeltsam said: If I use this, the time left is always zero. The development Tools output also shows: PLAYER Buff/Debuff: Retribution Aura: ID=7294, Stack=1, TimeLeft=0 ms, Owner=0 Blessing of Might: ID=19834, Stack=1, TimeLeft=0 ms, Owner=0 Seal of the Crusader: ID=20162, Stack=1, TimeLeft=0 ms, Owner=0 Funny I recently came back after a couple of months off and had to remove the TimeLeft check in my cc because it would always be 0. Thought the bug was on my side. Using vanilla. Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-46816 Share on other sites More sharing options...
DrSeltsam 0 Posted August 24, 2018 Share Posted August 24, 2018 13 hours ago, pasdoy said: Funny I recently came back after a couple of months off and had to remove the TimeLeft check in my cc because it would always be 0. Thought the bug was on my side. Using vanilla. I am using Vanilla too. Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-46830 Share on other sites More sharing options...
Matenia 630 Posted August 24, 2018 Share Posted August 24, 2018 ... vanilla doesn't have a timer on buffs/debuffs, with the exception of your own. But they don't fall under the regular aura API so you have to use Lua to get specific timers. Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-46832 Share on other sites More sharing options...
someshit 0 Posted June 8, 2019 Share Posted June 8, 2019 need to calculate number of opponents within 8 yards of current target. any tips? Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-54386 Share on other sites More sharing options...
TheSmokie 242 Posted June 8, 2019 Share Posted June 8, 2019 1 hour ago, someshit said: need to calculate number of opponents within 8 yards of current target. any tips? if(ObjectManager.GetWoWUnitAttackables().Any(x=> x.Position.DistanceTo(ObjectManager.Me.Position) < 20)) { MovementManager.StopMove(); Fight.StartFight(ObjectManager.GetWoWUnitAttackables().OrderBy(x => x.Position.DistanceTo(ObjectManager.Me.Position)).FirstOrDefault().Guid); } Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-54387 Share on other sites More sharing options...
someshit 0 Posted June 9, 2019 Share Posted June 9, 2019 so, if(ObjectManager.GetWoWUnitAttackables().Any(x=> x.Position.DistanceTo(ObjectManager.Target.Position) <= 8 )) should work? Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-54394 Share on other sites More sharing options...
TheSmokie 242 Posted June 9, 2019 Share Posted June 9, 2019 5 minutes ago, someshit said: so, if(ObjectManager.GetWoWUnitAttackables().Any(x=> x.Position.DistanceTo(ObjectManager.Target.Position) <= 8 )) should work? Yeah Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-54395 Share on other sites More sharing options...
iMod 99 Posted December 25, 2020 Share Posted December 25, 2020 WoWUnit Extension "IsAutoAttacking" (WOTLK) /// <summary> /// Gets the flag if the unit is auto attacking. /// </summary> /// <returns>Returns true if the unit is auto attacking, otherwise false.</returns> public static bool IsAutoAttacking(this WoWUnit instance) { // Read bool result = Memory.WowMemory.Memory.ReadBoolean(address: instance.GetBaseAddress + (uint)0xA20); // Return return result; } I'm not sure about the other extension offsets. TheSmokie 1 Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-60880 Share on other sites More sharing options...
Sleepwalker 1 Posted February 12, 2021 Share Posted February 12, 2021 Is there any snippets for having more than 1 target? I'd like to use Swipe in AoE 2+ targets and Shred in single target Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-61219 Share on other sites More sharing options...
Talamin 138 Posted February 12, 2021 Share Posted February 12, 2021 You can check this out, really good Base for a Fightclass! https://github.com/Schaka/wRobotFightclassFrameworkEnhanced Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-61220 Share on other sites More sharing options...
Sleepwalker 1 Posted February 12, 2021 Share Posted February 12, 2021 1 hour ago, Talamin said: You can check this out, really good Base for a Fightclass! https://github.com/Schaka/wRobotFightclassFrameworkEnhanced I was more looking for something implemented into the wrobot api itself so I wouldn't have to rewrite my whole fight class sorry, but that looks real nice! Maybe there's something I can use with ObjectManager like unit count that's in range of me or something? Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-61221 Share on other sites More sharing options...
iMod 99 Posted February 15, 2021 Share Posted February 15, 2021 On 2/12/2021 at 8:12 PM, Sleepwalker said: Is there any snippets for having more than 1 target? I'd like to use Swipe in AoE 2+ targets and Shred in single target UnitExtension: /// <summary> /// Gets the units around our unit in the given range. /// </summary> /// <param name="range">The range we are looking in.</param> /// <param name="objectType">The object type we are looking for.</param> /// <returns>Returns a list of units if we found one, otherwise a empty list.</returns> public static IEnumerable<WoWUnit> GetAttackableUnits(this WoWUnit instance, int range, WoWObjectType objectType = WoWObjectType.Unit) { // Get units IEnumerable<WoWUnit> results = ObjectManager.GetObjectWoWUnit().Where(u => u.Type == objectType && u.IsAlive && u.MaxHealth > 500 && (u.Position.DistanceTo2D(instance.Position) <= range) && u.IsAttackable && !TraceLine.TraceLineGo(u.Position)); // Return return results; } Sample: bool useSwipe = (ObjectManager.Me.GetAttackableUnits(5).Count() >= 3); Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-61249 Share on other sites More sharing options...
Sleepwalker 1 Posted February 18, 2021 Share Posted February 18, 2021 On 2/15/2021 at 10:33 AM, iMod said: UnitExtension: /// <summary> /// Gets the units around our unit in the given range. /// </summary> /// <param name="range">The range we are looking in.</param> /// <param name="objectType">The object type we are looking for.</param> /// <returns>Returns a list of units if we found one, otherwise a empty list.</returns> public static IEnumerable<WoWUnit> GetAttackableUnits(this WoWUnit instance, int range, WoWObjectType objectType = WoWObjectType.Unit) { // Get units IEnumerable<WoWUnit> results = ObjectManager.GetObjectWoWUnit().Where(u => u.Type == objectType && u.IsAlive && u.MaxHealth > 500 && (u.Position.DistanceTo2D(instance.Position) <= range) && u.IsAttackable && !TraceLine.TraceLineGo(u.Position)); // Return return results; } Sample: bool useSwipe = (ObjectManager.Me.GetAttackableUnits(5).Count() >= 3); Thanks for this, seems way more neat than what I have going on at the min. Another issue I've ran into though is when there's more than 1 feral in the group it doesn't keep up rake anymore since it can see his rake debuff on the boss. Is there any way to make it use my personal applied debuffs rather than everyones? Here's my rake snippet: // Rake if (Rake.KnownSpell && Rake.IsSpellUsable && Rake.IsDistanceGood && !ObjectManager.Target.HaveBuff(9904) && ObjectManager.Target.BuffTimeLeft(new List<uint> { 9904 }) < 1000) { Rake.Launch(); Lua.LuaDoString(@"dRotationFrame.text:SetText(""Casting Rake"")"); return; } Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-61289 Share on other sites More sharing options...
Matenia 630 Posted February 18, 2021 Share Posted February 18, 2021 You can check owners. Either use an IDE or check documentation on what Auras on enemy provide in terms of attributes/methods Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-61290 Share on other sites More sharing options...
Sye 1 Posted March 8, 2021 Share Posted March 8, 2021 (Csharp) Return Deadly Postion Stack count. public static int ReturnDeadlyPosionStacks { get { return Lua.LuaDoString<int>(@" local DeadlyPoison = {'Deadly Poison', 'Deadly Poison II', 'Deadly Poison III', 'Deadly Poison IV', 'Deadly Poison V', 'Deadly Poison VI', 'Deadly Poison VII','Deadly Poison VIII', 'Deadly Poison IX'} local DeadlyPoisonStackCount = 0; for Poison = 1, #DeadlyPoison do for i = 1, 20 do local name, _, _, count = UnitDebuff('target', i); if name and string.find(name, DeadlyPoison[Poison]) then DeadlyPoisonStackCount = count; end end end return DeadlyPoisonStackCount;"); } } Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-61459 Share on other sites More sharing options...
Sye 1 Posted March 31, 2021 Share Posted March 31, 2021 (Csharp) - return all the Glyph a player has. private static List<string> Glyphs() { var GlyphNames = @" local Index = {} for i = 1, GetNumGlyphSockets() do local id = select(3, GetGlyphSocketInfo(i)); if id ~= nil then local GlyphName = GetSpellInfo(id); tinsert(Index, GlyphName); end end return unpack(Index); "; return Lua.LuaDoString<List<string>>(GlyphNames); } or if people do not wanna use .Contain in a list format. here is a boolen. private static bool Glyphs(string GlyphNum) { var GlyphNames = $@" for i = 1, GetNumGlyphSockets() do local id = select(3, GetGlyphSocketInfo(i)); if id ~= nil then local GlyphName = GetSpellInfo(id); if GlyphName and string.find(GlyphName, ""{GlyphNum}"") return true; break; end end end return false; "; return Lua.LuaDoString<bool>(GlyphNames); } Pudge 1 Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-61706 Share on other sites More sharing options...
sakado 0 Posted October 13, 2023 Share Posted October 13, 2023 Can you share all the libraries in a list? Link to comment https://wrobot.eu/forums/topic/3573-snippets-c-codes-for-fight-classes/#findComment-68844 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