public override bool Buff()
 {
     // Do we have a pet?
     if (this.Player.GotPet())
     {
         // Is Pet dead?
         if (Pet.HealthPercent == 0)
         {
             // Revive it. Tell bot we are not buffed (false)
             Pet.Revive();
             return(false);
         }
         // Do we stil have food for our pet?
         else if (this.Pet.GotPetFood)
         {
             // Is our pet not happy?
             if (!this.Pet.IsHappy())
             {
                 // Is pet 'eating'?
                 if (!Pet.GotBuff("Feed Pet Effect"))
                 {
                     // if it is not feed it
                     this.Pet.Feed();
                 }
                 // tell the bot we are not buffed
                 return(false);
             }
         }
     }
     else
     {
         if (SummonPet)
         {
             // we dont have a pet? call it
             Pet.Call();
             return(false);
         }
     }
     // We dont have aspect of the hawk?
     if (Player.GetSpellRank("Aspect of the Hawk") != 0 && !Player.GotBuff("Aspect of the Hawk"))
     {
         // use it
         Player.Cast("Aspect of the Hawk");
         return(false);
     }
     return(true);
 }
Exemplo n.º 2
0
        //API doesn't currently support custom pet food - this is a workaround
        public void Feed(String food)
        {
            string luaCheckFeed = "CanFeedMyPet = 0; if CursorHasSpell() then CanFeedMyPet = 1 end;";
            string luaFeedPet   = "CastSpellByName('Feed Pet'); TargetUnit('Pet');";
            string UsePetFood1  = "for bag = 0,4 do for slot = 1,GetContainerNumSlots(bag) do local item = GetContainerItemLink(bag,slot) if item then if string.find(item, '";
            string UsePetFood2  = "') then PickupContainerItem(bag,slot) break end end end end";

            if (!Pet.GotBuff("Feed Pet Effect"))
            {
                if (Player.ItemCount(food) != 0)
                {
                    Player.DoString(luaCheckFeed);
                    if (Player.GetText("CanFeedMyPet").Trim().Contains("0"))
                    {
                        Player.DoString(luaFeedPet);
                    }
                    Player.DoString(UsePetFood1 + food.Replace("'", "\\'") + UsePetFood2);
                }
            }
            Player.DoString("ClearCursor()");
        }
Exemplo n.º 3
0
 public override bool Buff()
 {
     if (Player.GetSpellRank("Aspect of the Hawk") != 0 && !Player.GotBuff("Aspect of the Hawk"))
     {
         Player.Cast("Aspect of the Hawk");
         return(false);
     }
     if (this.Player.GetSpellRank("Call Pet") != 0)
     {
         if (this.Player.GotPet())
         {
             if (this.Pet.HealthPercent == 0)
             {
                 Pet.Revive();
                 return(false);
             }
             if (this.Pet.HealthPercent <= 50)
             {
                 if (Player.GetSpellRank("Mend Pet") != 0)
                 {
                     Player.CastWait("Mend Pet", 500);
                 }
                 return(false);
             }
             if (!this.Pet.IsHappy())
             {
                 if (this.Pet.GotPetFood)
                 {
                     if (!Pet.GotBuff("Feed Pet Effect"))
                     {
                         this.Pet.Feed();
                     }
                     return(false);
                 }
                 else
                 {
                     string food = this.Player.GetLastItem(PetFoodName);
                     if (food != String.Empty)
                     {
                         if (!Pet.GotBuff("Feed Pet Effect"))
                         {
                             Feed(food);
                         }
                     }
                 }
             }
         }
         else
         {
             if (SummonPet)
             {
                 Pet.Call();
                 return(false);
             }
         }
     }
     else
     {
         return(true);
     }
     return(true);
 }
Exemplo n.º 4
0
        public override bool Buff()
        {
            // Do we have a pet?
            if (this.Player.GotPet())
            {
                // Is Pet dead?
                if (Pet.HealthPercent == 0)
                {
                    // Revive it. Tell bot we are not buffed (false)
                    Pet.Revive();
                    return(false);
                }

                if (Pet.HealthPercent <= 50)
                {
                    // Revive it. Tell bot we are not buffed (false)
                    if (Player.GetSpellRank("Mend Pet") != 0)
                    {
                        Player.CastWait("Mend Pet", 500);
                    }
                    return(false);
                }

                // Is our pet not happy?
                if (!this.Pet.IsHappy())
                {
                    //Do we have food set in UI?
                    if (Pet.GotPetFood)
                    {
                        // Is pet 'eating'?
                        if (!Pet.GotBuff("Feed Pet Effect"))
                        {
                            this.Pet.Feed();
                        }
                        // tell the bot we are not buffed
                        return(false);
                    }
                    else     // If we don't have food set in the UI
                    {
                        string food = this.Player.GetLastItem(PetFoodName);
                        if (food != String.Empty)
                        {
                            if (!Pet.GotBuff("Feed Pet Effect"))
                            {
                                Feed(food);
                            }
                        }
                    }
                }
            }
            else
            {
                if (SummonPet)
                {
                    // we dont have a pet? call it
                    Pet.Call();
                    return(false);
                }
            }
            // We dont have aspect of the hawk?
            if (Player.GetSpellRank("Aspect of the Hawk") != 0 && !Player.GotBuff("Aspect of the Hawk"))
            {
                // use it
                Player.Cast("Aspect of the Hawk");
                return(false);
            }
            return(true);
        }