• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Mr.LazyRaider - Your Guide to Writing a LazyRaider CC

    Discussion in 'Archives' started by CodenameG, Apr 26, 2012.

    1. CodenameG

      CodenameG New Member

      Joined:
      Jan 15, 2010
      Messages:
      38,369
      Likes Received:
      231
      Trophy Points:
      0
      Mr.LazyRaider - Your Guide to Writing a LazyRaider CC
      4/26/12 - Version 1.0

      What is this
      This is is a guide and template designed to help you to create your own CC for use with CombatBot, LazyRaider or Raidbot. you can find the at the links below. (combat bot is already packed with honorbuddy)
      http://www.thebuddyforum.com/honorb...ider-user-controlled-raiding-heroics-raf.html
      http://www.thebuddyforum.com/honorbuddy-forum/plugins/uncataloged/24775-lazyraider-user-controlled-raiding-heroics-raf.html

      What is a LazyRaider CustomClass?
      A LazyRaider CC is a CustomClass built specifically for use with LazyRaider or Similar bots, as LazyRaider is ment to be used while you control movement it makes it very easy for us to make one for just about any class. all our CC is going to do is run our combat rotation if we get into combat and have something targeted.

      What if ive never coded before?
      Then you will want to go over my Custom Class Creation Guide to learn how to setup your project in visual studio.
      http://www.thebuddyforum.com/honorb...1-how-write-custom-class-guide-beginners.html


      So what do i do?
      first things first you wanna get your project setup in visual studio and add the proper references to honorbuddy.exe and fasmdll_managed.dll
      once thats done scroll down to the bottom of the post for and download. MrLazyRaider.cs this is a template i made for you packed with some extra methods to help you with the Custom Class Creation process. feel free to rename MrLazyRaider.cs to MrLazyRaider - *classname or other unique name here* so you know thats what your working on.

      once you have that done, there are only a couple of things inside a CC we need to worry about when writing a LazyRaider CC.
      [HR][/HR]the first thing is.


      Code:
      
      //Change WoWClass.***** to change the class your routine works for.
      public override WoWClass Class { get { return WoWClass.Mage; } }
      
      as you can see i took the time to comment everything for you, and this should be easy to find. this tells honorbuddy What Class this is suppose to be used on. and by default its set to mage. you can easily change this by replacing mage. with what class you want.

      For Example.
      Code:
      //Change WoWClass.***** to change the class your routine works for.
      public override WoWClass Class { get { return WoWClass.Warlock; } }
      
      if you have your visual studio project setup correctly visual studio should try and auto complete what your trying to do. but by changing it to Warlock our code will now run for a Warlock instead of a mage.

      [HR][/HR]the second thing is.
      if you scroll down a bit you should find this.
      Code:
       public override void Combat()
              {
                  //All your code goes here.
                  //Wrapped Items.
                  //CastSpell(SpellName) & CastSpell(SpellName, WoWUnit)
                  if(HaveManaPotion() && ManaPotionReady() && Me.ManaPercent <= 30)
                  {
                      UseManaPotion();
                  }
                  if (HaveHealthPotion() && HealthPotionReady() && Me.HealthPercent <= 30)
                  {
                      UseHealthPotion();
                  }
      
      
              }
      
      public override void Combat() is the method honorbuddy pulses when in combat since we are writing a CustomClass that ONLY functions in combat, this is where a large majority of our code will be. as you can tell, i took the liberty of including some methods you can use to castspells. and ive included code to automatically use health and Mana potions.

      so say i wanted this cc to get into combat and spam fireball.
      heres what i would do.
      Code:
       public override void Combat()
              {
                  CastSpell("Fireball");
      
      
                  if(HaveManaPotion() && ManaPotionReady() && Me.ManaPercent <= 30)
                  {
                      UseManaPotion();
                  }
                  if (HaveHealthPotion() && HealthPotionReady() && Me.HealthPercent <= 30)
                  {
                      UseHealthPotion();
                  }
      
      
              }
      
      of course i left the mana potion stuff in, but we can take it out if we dont want it.
      [HR][/HR]
       

      Attached Files:

    2. CodenameG

      CodenameG New Member

      Joined:
      Jan 15, 2010
      Messages:
      38,369
      Likes Received:
      231
      Trophy Points:
      0
      Community Methods:
      below is a list of methods you can add to your CustomClass to easily add functionality to your customclass.
      if you have more to add please follow the formatting i have here, and post them, i will add them as time goes by.

      Heres Whats included with MrLazyRaider.

      AutoAttack();
      Starts the Bot AutoAttacking, This works well when used in conjunction with a range check.
      Code:
      if(Me.CurrentTarget.IsWithinMeleeRange)
      {
       AutoAttack();
       }
      
      BuffMe("String");
      Checks if We CanBuff ourselves if so then it casts the buff.
      Usefull for buffs that always need to be up.
      Code:
      BuffMe("Arcane Intellect");
      
      CastSpell("String");
      Checks if we can Cast the Spell if so then Spell is casts on Whatever is currently targeted
      Code:
      CastSpell("Frostbolt");
      

      CastSpell(int);
      Casts a Spell by ID
      Code:
      CastSpell(12345);
      
      CastSpell("String", WoWUnit);
      Casts a spell on a WoWUnit, wowunit does not have to be CurrentTarget.
      Code:
      CastSpell("Frostbolt", Me.CurrentTarget.Pet);
      
      CastSpell(int, WoWUnit)
      Casts a Spell on a WoWunit, by using a Spell Id
      Code:
       CastSpell(12345, Me.CurrentTarget);
      
      CurrentAddCount()
      returns a count of all units in combat that are targeting you, minus the unit you have targeted.
      Code:
      if(CurrentAddCount() > 3)
      {
      CastSpell("Frostnova");
      }
      
      HaveManaPotion()
      Determines of we have a mana potion or not.
      if(HaveManaPotion())
      {
      your code here.
      }

      ManaPotionReady()
      Checks if the ManaPotion we have (if we have one) is ready to be used
      Code:
      if(ManaPotionReady())
      {
      your code here
      }
      
      UseManaPotion()
      Uses the ManaPotion if one was found and ready to use.
      Code:
      if(HaveManaPotion() && ManaPotionReady() && Me.ManaPercent *Less then or Equals* 30)
      {
        UseManaPotion();
      }
      
      HaveHealthPotion()
      Checks if we have a Health Potion available
      Code:
      if(HaveHealthPotion())
      
      HealthPotionReady()
      Checks if the HealthPotion we had is Ready
      Code:
      if(HealthPotionready())
      
      UseHealthPotion()
      Uses the HealthPotion if its not on cooldown
      Code:
              if (HaveHealthPotion() && HealthPotionReady() && Me.HealthPercent *Less Than Or Equals* 30)
              {
                  UseHealthPotion();
              }
      
       
      Last edited: Apr 26, 2012
    3. CodenameG

      CodenameG New Member

      Joined:
      Jan 15, 2010
      Messages:
      38,369
      Likes Received:
      231
      Trophy Points:
      0
      open for business.
       
    4. Hawker

      Hawker Well-Known Member Buddy Core Dev

      Joined:
      Jan 15, 2010
      Messages:
      2,509
      Likes Received:
      70
      Trophy Points:
      48
      Great job - thanks!
       

    Share This Page