What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

Redoing buffing

Venus112

New Member
Joined
Jun 17, 2010
Messages
1,509
Reaction score
13
Hey Guys.
I'm trying to redo the buffing, as i'd like it to be a bit more intuitive.

So far i've done the following, but i'm getting a "Some codes does not return a value"

public bool ShouldMight()
{
foreach (WoWPlayer p in Me.PartyMembers)
{
if (p.Class == WoWClass.Druid) { return true; }
{
if ((p.ActiveAuras["Blessing of Might"].CreatorGuid != Me.Guid) && !Me.HasAura ("Blessing of Might"))
{
if (CastSpell("Blessing of Might") == true)
{
Logging.Write(Color.Lime, "Blessing of Might");
return true;
}
}
}
return false;
}
}

I want it to buff BoM if there's a druid in the group, but i dont really see the problem.

Anyone got an idea?
Else i'll just go back to the old buffing, i just didn't like the way it would buff BoM directly if a druid buffed MoTW or another paladin buffed BoK
 
Last edited:
Its a little hard on the eyes since you didnt include the tabs. but...

It looks like it will always return true if you have a druid in your party, regardless of needing buffs. So if there is a druid and people dont need buffs, you would end up spamming.

I would check to see if the buffs are needed, then do a druid check and pick you buff based off the druid check.

I see you are only checking party members. Try this out for checking the buffs...

Code:
private bool NeedBuff(String buff)
        {            
            foreach (WoWPlayer p in ObjectManager.GetObjectsOfType<WoWPlayer>(true, true))
            {
                if (p.IsInMyPartyOrRaid && !p.HasAura(buff) && p.Distance < 40 && p.IsAlive)
                {
                    return true;
                }
            }
            if (!Me.HasAura(buff) && Me.IsAlive)
            {
                return true;
            }
            return false;
        }

So make your druid check method and do

if(DruidPresent() && NeedBuff("Blessing of Might"))
{
cast("Blessing of Might");
}
 
Last edited:
I don't see why so many people are adding == true to their if statements, did someone use it in a class and you believe it to be correct?
 
So you're saying it's redundant?
I have it in my CC, as i've used Handnavi's CC to work on (yes i was allowed) and i'm in a learning phase.
 
So you're saying it's redundant?
I have it in my CC, as i've used Handnavi's CC to work on (yes i was allowed) and i'm in a learning phase.
I'm not sure of the definition of redundant but I am saying it's not necessary, any method/function that returns a boolean can be placed in a if statement with no need to check if it == true or == false.

If you want to check if a method/function is wrong/did not succeed you can use:
Code:
if(!CastSpell("Blessing of Might"))

If you want to check if a method/function is correct/succeeded you can use:
Code:
if(CastSpell("Blessing of Might"))

It will make your code alot easier to understand and stops you causing two if statements instead of one as == is a simpler way of saying if x = y then return true.
 
I've redone buffing and it seems to work. Only problem is in instances like End Time.
When i zone from around using portals

think it has with me using

foreach (WoWPlayer p in Me.PartyMembers)

Because i dont really see how to use the ObjectManager as suggested

Trying to use
Code:
        private bool DruidPalaPresent()
        {
            foreach (WoWPlayer p in ObjectManager.GetObjectsOfType<wowplayer><wowplayer>(true, true))
                {
                    if (p.Class == WoWClass.Druid) { return true; }
                    if (p.Class == WoWClass.Paladin) { return true; }
                    if ((p.Guid != Me.Guid)) { return true; }
                }
             return false;
        }

But i can't get the CC to stop returning true on that, because i am a paladin.
I've uploaded the entire buffing.
Can anyone spot a flaw? (Dont laugh at the coding, i'm a coding virgin)</wowplayer></wowplayer>
 

Attachments

Last edited:
It's so... logical... First look at what you've written so far, correctly indenting (I'm surprised Visual C# didn't it for you... copy/pasting?).

PHP:
        private bool DruidPalaPresent()
        {
            foreach (WoWPlayer p in ObjectManager.GetObjectsOfType<WoWPlayer>(true, true))
                {
                    if(p == Me) 
                        if (p.Class == WoWClass.Druid) { return true; }
                    if (p.Class == WoWClass.Paladin) { return true; }
                    if ((p.Guid != Me.Guid)) { return true; }
                }
             return false;
        }

This means:
- Take all the players around me (note: there's a double Type in GetObjectsOfType, correct it)
- If it's me and I'm a Druid, return true
- If it's a Paladin, return true
- If it's not me, return true

- Return false

What do you EXACTLY want to do? Please note that the (p == Me) check will be cast on the druid class check only.

From the method name I have to suppose you want to return true whenever there is a druid or a paladin, right?

PHP:
        private bool DruidPalaPresent()
        {
            foreach (WoWPlayer p in ObjectManager.GetObjectsOfType<WoWPlayer>(true, true))
            {
                if(p.Class == WoWClass.Druid || p.Class == WoWClass.Paladin)
                    return true;
            }
            return false;
        }

Eventually, if you want to check all but you, use this code (read the docs of ObjectManager.GetObjectsOfType<T>() + overloads)
PHP:
        private bool DruidPalaPresent()
        {
            foreach (WoWPlayer p in ObjectManager.GetObjectsOfType<WoWPlayer>(true, false))
            {
                if(p.Class == WoWClass.Druid || p.Class == WoWClass.Paladin)
                    return true;
            }
            return false;
        }
Or even without the second bool (even if I'm not sure about that, it's abiguous in the definition).
 
Last edited:
Think i've gotten it to work now.

Was actually not the check to see if there was a Paladin or Druid in group, that produced the error.
Gonna have to wait till i get time to do a End Time Heroic, to see if it got fixed

Thank you
 
Last edited:
Back
Top