Jump to content

Playerbot


Recommended Posts

  • Replies 799
  • Created
  • Last Reply

Top Posters In This Topic

Hi Gitch,

One additional thing you could use that I'm trying at present with your code is the function IsItemUseful() that was created to control which bot gets what while looting. A problem with paladins is that they can equip all classes of armour. You have already mentioned that some of your bots appear to be cross-dressers (no accounting for taste) :lol: Ideally you only want paladins to equip mail (plate when available). I recently updated the code for IsItemUseful() to enforce this behaviour. So all you need to do is add this to your conditions.

if (GitNewMaxValue > GitOldMaxValue && GitNewArmor >= GitOldArmor && IsItemUseful(pProto2->ItemId)) // itemlevel

EquipItem(*it);

// now in case they are same itemlevel, but one is better than the other..

if (GitNewMaxValue == GitOldMaxValue && GitNewQuality > GitOldQuality && GitNewArmor >= GitOldArmor && IsItemUseful(pProto2->ItemId))

EquipItem(*it);

This should stop hunters, rogues, warriors and paladins from donning cloth robes.

Hope this helps

Link to comment
Share on other sites

@blueboy,

Thanks! I'll add that in.

And I've changed the conditions to as follows, and dropped the old variables to clean things up a bit:

this doesn't include your changes, will add those in now.

case ITEM_CLASS_ARMOR:

{

if (pProto->ItemLevel < pProto2->ItemLevel && pProto->Armor <= pProto2->Armor) // itemlevel

EquipItem(*it);

// now in case they are same itemlevel, but one is better than the other..

if (pProto->ItemLevel == pProto2->ItemLevel && pProto->Quality < pProto2->Quality && pProto->Armor <= pProto2->Armor)

EquipItem(*it);

}

Link to comment
Share on other sites

Update: AutoEquip

Pushed to branch skillbot

Updates for melee weapon choice thanks to blueboy. Weapon choice according to item DPS.

Updates to armor choice thanks again to blueboy.

Cleaned up code... finally!

Thanks for all the suggestions/changes and testing on this guys :D

I like green!

doh something got broken, pushing a fix asap. (its compiling now)

Link to comment
Share on other sites

Fix: for bot reporting sellable items when master sells.

This was causing the sellables from other bags to NOT be listed.

Patch:

diff --git a/src/game/playerbot/playerbotai.cpp b/src/game/playerbot/playerbotai.cpp
index 80542bc..dc5a2f8 100644
--- a/src/game/playerbot/playerbotai.cpp
+++ b/src/game/playerbot/playerbotai.cpp

@@ -6815,7 +6845,7 @@ void PlayerbotAI::SellGarbage(bool bListNonTrash, bool bDetailTrashSold, bool bV
    // and each of our other packs
    for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; ++bag)
    {
-        std::ostringstream goods;
+        // std::ostringstream goods;
        const Bag* const pBag = static_cast<Bag *>(m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag));
        if (pBag)
        {


Still working on fix for autoequip- incoming shortly

There HAS to be a gnome behind this...

(if any of ya are wondering about all this activity I've been into lol, I have alot of time at home (possibly get to go back to work soon !) so

This has given me something to put my idle hands to) Grandkids will be here this weekend, so I'll be scarce for a few days. :lol:

Link to comment
Share on other sites

Hey guys,

I noticed my healbots weren't dispelling, so I went ahead and implemented it!

I didn't comment the code yet so i'll post it here and add a few in case anyones interested:

//If spell exists and orders say we should be dispelling

if (REMOVE_CURSE > 0 && ai->GetCombatOrder() != PlayerbotAI::ORDERS_NODISPEL)

{

//This does something important(lol)

uint32 dispelMask = GetDispellMask(DISPEL_CURSE);

//Get a list of all the targets auras(spells affecting target)

Unit::SpellAuraHolderMap const& auras = target->GetSpellAuraHolderMap();

//Iterate through the auras

for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)

{

SpellAuraHolder *holder = itr->second;

//I dont know what this does but it doesn't work without it

if ((1<<holder->GetSpellProto()->Dispel) & dispelMask)

{

//If the spell is dispellable and we can dispel it, do so

if(holder->GetSpellProto()->Dispel == DISPEL_CURSE)

ai->CastSpell(REMOVE_CURSE, *target);

return false;

}

}

}

The bots will dispel by default(and also with heal orders)

but for fights that you might not want auto dispels (Heroic Lich King for example >.>) I added a combat order ORDER_NODISPEL that won't(I hope) dispel

This needs heaps of testing so if anyone finds anything wrong with it, or even if they don't I'd appreciate feedback

Link to comment
Share on other sites

Pushed to skillbot

fix for sellable list; code cleaning.

If any issues with current code, let me know.

I had some issues here, but am not certain what caused it... one of my accounts is bugged it seems.

With a new account, testing went fine, and autoequip worked as it should.

Link to comment
Share on other sites

I have an odd problem.. I have one bot that isnt working right ..

He wont autoequip, and wont send me any message with his items for sale.

The other bots do all the above, and they are all logged in at the same time.

If I log all out but the one bot, he still does not work.. he follows, heals, buffs, fights...

This bots been like this for no telling how long, so really don't know what caused it.

Any ideas where to look?

Link to comment
Share on other sites

Hi Gitch,

Sounds peculiar. Are you sure the bot is a member of the curent group. The system might have got confused as to who is a party member or not. If for instance you change who the master is (As a player if you logout and back in as one of other bots), it might require that you recreate the party. If you right click on the player avatar and select 'leave party'. Then invite the bots again with the new master. If the offending bot is not in the party and a command is directed to the party (/p) it will be ignored. Just an idea

Hope this helps

Link to comment
Share on other sites

//I dont know what this does but it doesn't work without it

I lol'ed :) So glad I'm not the only one...

Need some opinions... I'm looking at adding checks for item stats. I need input on what to check and what importance to put on that stat for caster/melee.

I've posted the item stats list above in previous post.

I really don't want to check every single stat .. any ideas which ones would be good to focus on?

As lazy as I am and as much as I'd like to tell you to take my advice and go google it (after my [sarcasm]brilliant[/sarcasm] speech on theorycrafting), I really can't after all your work. You, sir, have shamed me into not being lazy for just a moment...

http://www.google.be/search?q=wow+weight+stats+3.3.5 A good place to start for which stats to focus on.

http://www.wowhead.com/forums&topic=100050/warlock-faq--current-for-3-3-5 One example, in this case for a warlock, which brings us to...

http://www.wowhead.com/forums&topic=100050 Being a warlock fan I can't say i agree 100% (and what's worse, there's no actual weighting as in "+spell is worth 2.4 stamina") but for a bot it should do just fine. Keep in mind with that page you will need to add your own weighting. It may tell you spell>sta, but if you equip a +1 spell equipment over say a +100 stamina equipment... You'll be having people after you with torches and pitchforks. So it's a good start but you'll need to mix in some common sense. Also, as far as this page goes, levelling = pve level 1-79; pve = level 80. For the warlock it works out that levelling gear is good enough for 1-79 pvp as well, and this page's listed pvp really means pvp level 80.

http://www.google.com/search?q=simulationcraft+3.3.5 Finally the page mentions simulation craft, the old version is a bit tricky to find so here you go. There's also numerous mentions of RAWR everywhere (including some of the older pages in this topic) so perhaps that's worth looking into for class+talentspec+purpose weighting.

Link to comment
Share on other sites

@Kennumen,

I'm the one that was being lazy :P

Thanks for the links, and for looking it up. Have made some bookmarks, and when I'm done fixing the mess I made last night (when I thought something had gone haywire but wound up just one of my bots is on the blink) I'll dig into this!

Skillbot branch should be fine, just have to reorganize on my end so I don't lose changes I made here.

It's what I get for getting into too many things at one time lol.

Still having fun.

@blueboy,

No luck with bugged bot.. will have to reroll a priest.

If anyone else experiences any issues let me know.

It might be the account itself thats bugged. New accounts work fine. 2 accounts not working, including gm account.

running some tests, I want to make sure this isn't linked to autoequip.

***EDIT***

Cancel the 911 call... the bots are just being Extremely picky.. too picky mostly.

One hunter is prefering a skinning knife over a very nice axe, and priest is choosing all sub par items.

Anyway, just glad it wasn't 'broken'. Just needs tweaking! *whew* :lol:

These issues may (probably will) vary from one level range to another.. will take alot of testing at various level ranges.

Issue with bot sellable list found, and working on it:

if bot has 4 large extra bags, and full... they won't list their items for sale, any items at all.

for now, open the trade window with bot, get their list. use this list to choose from and do /t botname sell (items from that list) until its small enough to show up.

Issue is I'm using 4 huge brown sacks on my bots lol.. and this bot was just too full of stuff for it to be listed. I'm working on a possible fix for this.

Link to comment
Share on other sites

Found a fatal error with autoequip..

Its odd.. I was working on the bot's sellable list and when I found the problem with it..

Its the exact same problem autoequip runs into. Its an issue with using item lists to work from.

If a bot has extra bags ( like mine, BIG bags) they get too many items and the list goes haywire.

The bot essentially cant see whats in his extra bags(at least not all of them mine couldnt see the last bag where

the good stuff was lol) if the list gets too full.

Same thing happens with the "I can also sell" list. I've come up with what I "think" is a good solution.

The code will check each Item at a time as it goes through the bags which will actually be more efficient

because before, the code went through all the bags, made a list, and THEN compared each item which

took twice as long as it should.

I'm going to apply this same theory to the sellable list and try it if the author doesn't mind..

In fact I guess I've already taken too much liberty without checking first.. Hope I don't offend anyone with

any of my messing around with code O:)

New Function (used in conjunction with AutoUpgradeEquipment) is AutoEquipComparison(Item *pItem, Item *pItem2)

Working on compile, and testing. If all goes well will have a push later.

@Blueboy,

Hope this doesnt mess up what you're doing with the code..

It shouldn't, as the section you've been working with is all situated in the new function pretty much as it was in the old.

I think this makes coding this simpler, and sure looks like it will take a load off the server when 4 bots all decide to call the function at once =D

Also, the new function will serve (I think) as a good item comparison function to call for just about anything (with a little work).

This way, all the decision making(concerning weapons and armor etc for bots) we add to this function we can use for other purposes if needed. When I get ready to push I'll

Outline what it does and how the information gets passed.

Back to my corner!

***EDIT***

It works!

Making some tweaks.

Adding a command (temporary probably) to force your bot/bots to run through the autoequip cycle for whatever reason. (you forced them to equip a certain item etc or maybe changed their orders **future addon- command to set armor/weapon preferences**)

Link to comment
Share on other sites

Update and Pushed to branch skillbot for consumption

Finally :lol:

AutoEquip updates:

1.) New function - PlayerbotAI::AutoEquipComparison(Item *pItem Item *pItem2)

2.) New command- 'autoequip now' - using this command with /t botname or /p will cause one, or all bots in party to ignore their autoequip setting and run the

autoequip cycle just once for your pleasure, whether they need it or not.

3.) This made the code much neater and easier to follow.

Outline:

searches the backpack , one slot at a time for items. if it finds an item, it checks to see if equippable. If so, it gets the equipment slot, and checks to see if

bot has anything equipped in that slot. if not, it equips this item(might be a robe!). If so, it sends equipped item, AND found item to the new function to be compared by itemlevel, armor, quality, and last but not least blueboy's isitemuseful function to determine if this bot wants to use the item. These checks will grow and get more complicated.

It follows this process through backpack, and all equipped bags This is what it did before (kinda) except it was adding all the items to an array(list) first

and THEN going back through the list and comparing.. thats nice for santa, but not for bots :lol:

If you take a look at this and see a better way of doing it, by all means let me know.

Bots sell List update:

You'll notice some changes here. When you go to sell, the bot will list his/her backpack items first, then each bag that actually has something in it,

be it 1 item or 10. They wont say anything about empty bags. I'm looking at a way to make it read out more like the way it was. Will update when

I can test it out.

Its not pretty, but for now you'll know everything they have to sell. I think at least one of the other item listing functions have this same problem (and one doesn't)

Since these issues were similar, I made a minor change or two (mainly just changed where the itemLink gets output so that no links get missed we hope)

This is in the SellGarbage() function.

What led me to find this was when I noticed the bots weren't listing things that I KNEW they had.. I thought they had lost some items, or dropped them

or something.. If you don't have extra bags on yer bots, you won't notice this.

If I go too far in changes, honestly, let me know :)

Link to comment
Share on other sites

Hey guys,

Updated shaman AI so they don't iterate through their totems only to end up with nature resistance or something stupid

The totems are spec based and are set for now as there is currently no way to tell which totem is active (aura checking doesn't seem to work)

Its set so they will only replace their totems if they go out of range (30 yds) or if the totems run out

I'll be working on a way to tell if a totem or equivalent buff is active so they can choose totems accordingly

As always, testing is appreciated

@blueboy

I pushed to new-ai(I'm pretty sure) and I think I figured out what was giving you problems, I hadn't set git up correctly lol

Should be fine but if you have any issues let me know

Link to comment
Share on other sites

gitch u should make the bot to autosell junk items

Although personally I wouldn't go any further than all gray items, white armor/weapons of which you're wearing green or better, and perhaps under-levelled food (e.g. level 5 food when you're level 15+). Beyond this it's not easy to decide what may or may not be useful...

Link to comment
Share on other sites

gitch u should make the bot to autosell junk items

Although personally I wouldn't go any further than all gray items, white armor/weapons of which you're wearing green or better, and perhaps under-levelled food (e.g. level 5 food when you're level 15+). Beyond this it's not easy to decide what may or may not be useful...

I like this. Could probably use item comparison to assist with it.

I especially like the idea of getting rid of outleveled food etc, and white items can easily ( I think) be weeded out by Itemlevel as well as quality.

Thanks for the suggestions! :D

***EDIT***

The bots "I could also sell" list is terribly sloppy after fix...

Have a fix for it that should look more like it was intended originally.

Several other things in the works, so will push all together later tonight

unless something major pops up that needs attention sooner.

Tuning the auto sellable items. Blueboy's IsItemUseful() query is going to come in handy here. May need to add some further checks to it possibly? (hint hint! O:) )

Link to comment
Share on other sites

@blueboy,

Some handy modifications to IsItemUseful() would be:

1.) if (pProto->SubClass == ITEM_SUBCLASS_WEAPON_MISC) // tradeskill weapons, mining picks, skinning knife etc. Looks like this subclass covers all the tradeskill tools.

2.) support for the use of comparing items requiredlevel to m_bot->getlevel which isnt possible atm, (to my knowledge anyway!)

for example:

if (pProto->FoodType != 0 && (pProto->RequiredLevel < (m_bot->getLevel() - 10)))

return false;

Just suggesting!

For now I've added the necessary code to cover this from within _dosellitems() itself.

Think it would be easier to call IsItemUseful() for the majority of the checks if possible.

Getting close to a push I think, will up date when I do.

Link to comment
Share on other sites

Update: Auto Sell ->Pushed to branch skillbot

New Subcommand: 'sell all' - type '.help sell' for details- /t botname or /p ; Use Before talking to vendor. Resets after sale, so have to

give the command each time BEFORE you sell, IF you want the bots to auto sell low level white items.

FUTURE: If tests work out, will make it automatic (or at least will set them to auto sell, and it stays until you change it)

Fine tuning! (may reduce the level difference depending on feedback)

NOTE: this update does not affect the auto sale of gray trash items. It will still function as usual.

Features:

1.) Bot/bots will auto sell all white (normal quality) Weapons/Armor items that have a level requirement 10 levels or lower

than the bots current level.

2.) Bot/bots will NOT auto sell items involved with quests, OR tradeskill tools (e.g. blacksmithing hammer, fishing pole, skinning knife etc)

3.) Bot/bots will auto sell all food items that have a level requirement 10 levels or lower than the bots current level.(so guard your pet food!)

4.) Bot/bots will NOT auto sell tradegoods (some tradegoods are involved in quests as well. Sell them manually if you wish til a better option)

5.) Fixed output text from bot to make the "I could sell" list prettier and more practical.

I'm looking at all other items, and there are alot more than can be sold automatically, but requires some more in depth comparisons.

(e.g. you dont want to sell your fishing lures etc lol)

Hope this helps! :)

Link to comment
Share on other sites

@Kenummen,

It's not as big of a demon as it sounds haha,

I made the Update notice as I went along, and in the process, removed some things, added.. etc..

In the end, I should have just stated...

Features:

1.) Bots will auto sell ONLY weapons, armor, food, drink which have a level requirement 10 levels or lower than the bots current level.

Only white items (other than food items they are considered by foodtype consumables) are checked for these conditions atm.

and they'll ONLy do this IF you type /t botname or /p 'sell all' before you speak to the merchant.

I guess it doesn't really do much, but in the end, I was so excited to be able to push it I made it sound more than it was lol.

BUT I enjoyed it nonetheless, especially when I saw the outcome when my bots sold

Its just that it took me so long to work out the thing in my head and find appropriate functions, I was tickled to be done haha. :lol:

Originally it DID in fact include all items meeting the level conditions, and I weeded out those that slipped through the cracks..

It worked well, but I saw enough items that would slip through that shouldn't, I took it out. I may put together enough conditions to make it work

when I get time.

I'm testing some 'one time only' settings that allow bot to sell everything that isnt nailed down(easier to check for what NOT to get rid of sometimes lol) simply cause there

are times I'd rather just see what they have, take what I want, and get rid of the rest.

On the Side Note: While testing, I got quite frustrated because while trying to determine if 'drink' was definitely a foodtype item, I could NOT locate 'ice cold mink' in the DB !!!!

I spent a good 30 minutes arguing with the DB before I noticed the spelling....

Link to comment
Share on other sites

@blueboy,

Some handy modifications to IsItemUseful() would be:

1.) if (pProto->SubClass == ITEM_SUBCLASS_WEAPON_MISC) // tradeskill weapons, mining picks, skinning knife etc. Looks like this subclass covers all the tradeskill tools.

2.) support for the use of comparing items requiredlevel to m_bot->getlevel which isnt possible atm, (to my knowledge anyway!)

for example:

if (pProto->FoodType != 0 && (pProto->RequiredLevel < (m_bot->getLevel() - 10)))

return false;

Just suggesting!

For now I've added the necessary code to cover this from within _dosellitems() itself.

Think it would be easier to call IsItemUseful() for the majority of the checks if possible.

Getting close to a push I think, will up date when I do.

Hi Gitch,

I've just been testing the latest autoequip code with a new party of bots. For some reason the priest was not replacing a low level neophyte's robe( armor 3, cloth class ) with the unkempt robe( armor 8, cloth class ). The problem is the IsItemUseful() function. It contains a filter for low quality items. I don't wish to alter this, as it is used elsewhere. However, you can still utilize the armour comparison code from the function in your AutoEquipComparison() function. You will need the declaration of the relational array 'item_armor_skills' and of course the test to see whether the bot can equip the item's armour class and not greater (i.e Paladin can wear mail; if the item is leather or cloth it will return false as it's not the best armour for the bot). I have included a patch below for you to try

diff --git a/src/game/playerbot/PlayerbotAI.cpp b/src/game/playerbot/PlayerbotAI.cpp
index b29c909..ff30c42 100644
--- a/src/game/playerbot/PlayerbotAI.cpp
+++ b/src/game/playerbot/PlayerbotAI.cpp
@@ -543,6 +543,11 @@ void PlayerbotAI::AutoUpgradeEquipment(Player& /*player*/) // test for autoequip

void PlayerbotAI::AutoEquipComparison(Item *pItem, Item *pItem2)
{
+    const static uint32 item_armor_skills[MAX_ITEM_SUBCLASS_ARMOR] =
+    {
+        0, SKILL_CLOTH, SKILL_LEATHER, SKILL_MAIL, SKILL_PLATE_MAIL, 0, SKILL_SHIELD, 0, 0, 0, 0
+    };
+
    // get itemlevel for current item equipped in slot

    ItemPrototype const *pProto = pItem2->GetProto(); // equipped item if any
@@ -567,11 +572,13 @@ void PlayerbotAI::AutoEquipComparison(Item *pItem, Item *pItem2)
        }
    case ITEM_CLASS_ARMOR:
        {
-            if (pProto->ItemLevel < pProto2->ItemLevel && pProto->Armor <= pProto2->Armor && IsItemUseful(pProto2->ItemId)) // itemlevel
+            if (pProto->ItemLevel < pProto2->ItemLevel && pProto->Armor <= pProto2->Armor &&
+            m_bot->HasSkill(item_armor_skills[pProto2->SubClass]) && !m_bot->HasSkill(item_armor_skills[pProto2->SubClass + 1])) // itemlevel + armour + armour class
                EquipItem(pItem);

            // now in case they are same itemlevel, but one is better than the other..
-            if (pProto->ItemLevel == pProto2->ItemLevel && pProto->Quality < pProto2->Quality && pProto->Armor <= pProto2->Armor && IsItemUseful(pProto2->ItemId))
+            if (pProto->ItemLevel == pProto2->ItemLevel && pProto->Quality < pProto2->Quality && pProto->Armor <= pProto2->Armor &&
+            m_bot->HasSkill(item_armor_skills[pProto2->SubClass]) && !m_bot->HasSkill(item_armor_skills[pProto2->SubClass + 1])) // itemlevel + armour + armour class
                EquipItem(pItem);        
            break;
        }

Hope this helps

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use