Jump to content

Playerbot


Recommended Posts

@blueboy,

I'll add the patch now, and thanks for noting it and working with it!

I do appreciate the help.

**Edit**

I've added the patch. Looks good to me!

I'll continue to test autoequip. atm my party is about to reach level 20, and so far things are working well.

I can confirm many uses of 'use' command on gameobjects/quest boards, inventory items (lady's necklace near tranquiell?) No issues there yet. just FYI.

I want to add code to cause bots to not only auto sell trash, but at the same time, auto buy a certain amount of class items (e.g. arrows relevant to their level etc)

Just looking at it atm, nothing coded.

If any other suggestions, please post 'em!

Link to comment
Share on other sites

  • Replies 799
  • Created
  • Last Reply

Top Posters In This Topic

Hi blueboy and other, just a little advise if you want to make your patch more readable..

use

[co de=diff]code[/co de] ofc without space for 'code' but olso without space after code and after equal.

to post your patch :)

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;
        }

Link to comment
Share on other sites

@blueboy,

Woke up and couldn't go back to sleep, so i started a new party as well, and so far, your patch is working fine. Thanks!

I still haven't looked at autoequipping loot won from a loot_roll. I scanned it once, and wasn't really sure where to call autoequip heh.

I called it from case smsg_loot_roll_won *or something like that* and nothing happened. I may look at it again, but over all, seems

the autoequip is working *fairly* well. At least its not so random now.

If you notice anything thing else holler.

I'm piecing together info to start comparing item stats/class usefulness info.

Link to comment
Share on other sites

Update: AutoEquip - Pushed to branch skillbot

The short and sweet of it: New function to judge Item stat types (e.g. str, int, spellpower). Initial TEST phase! Don't expect wonders from this. It's very basic atm.

The rest of autoequip is still as it was, and you actually might not even know this code exists yet, unless you really watch!(especially in low level areas where items have NO stats)

1.) New boolean -ItemStatComparison(Proto, proto2)- takes itemprototype of two items and compares their item stat types (not values yet, just their type)

It then takes the bots class, and the stat type, and determines the stats importance to that class (basic atm nothing too in depth).

It scores the item based on this, and then compares the next item. If pProto2 scores higher, ItemStatComparison returns true, Else returns false.

Needs testing so it can be pruned/tweaked/added to.

Basically its like this atm: Warrior bot loots an item that has +5 Intellect. He will not equip this item, I explain below:

Bot loots item. Function is called to check the item. (short version) function says warriors don't need intellect. The item doesn't get passed on to the remaining checks,

saving processor time, Yay! Function tells bot, yer outta luck bot, try another item!

However! If this had been a STR item, the item returns true, BUT it STILL has to pass the itemlevel, DPS, Quality, and Armor comparison checks.

If you want the bot to equip it anyway, you can still just tell them to equip it the old fashioned way! :cool:

this is just an example. At the moment the function looks for every stat type, on all 10 possible item stat slots.

I'll do my best to tweak the list, but anyone that looks at it is welcome to make changes/suggestions.

This section will take alot of testing/tweaking/hairpulling probably :lol:

The new function is LONG, very long... I'll prune it as best I can (though not sure I can and keep flexibility/depth of possibilities).

NOTE: One more thing I need to mention. If the new item, and the equipped item have the SAME itemlevel, and the SAME armor level and the SAME quality (LOL)

but one has better stats, you will have to tell the bot to equip the one you want. It will not (YET) auto equip in this situation as theres not been a condition added yet for it.

For good reason, the stat values aren't being checked yet, and until they are, I don't want bots to make hair splitting choices.

Link to comment
Share on other sites

Hi everybody !

I just want some help to understand why I can't compile correctly when I merge portal and mmaps.

I'm using Smartgit on Windows (don't think there is a Git.exe somewhere on my HD...) and merging causes lots of rewrites... It seems to be automatic.

What I do :

- I pull Portal from Blueboy's playerbot git

- I create a second remote (manage remotes) with Faramir118's git

- I merge Master with Faramir's

- Result : 6 files in conflict and lots of files added and auto modified.

- The conflicts : chat.cpp, level3.cpp, unit.cpp, movesplineinit.h, game.vcproj.filters and game.vcproj (deleted).

- I try to understand the problems, seems to be MoveTo multiple functions... but can't explain

- I tried Blueboy's git diff, but I didn't understand.

- I try I try, I finally try to compile on VC 2008, but have errors...

I'm French, and I write as I can ^^, but I want to keep Smartgit.

Can someone post the git diff in a comprehensive way ?

Thanks for the help !

Médiévalement !

Link to comment
Share on other sites

Hello Fellow Playerbot Enthusiasts!

Well A long time ago I had a complaint about playerbot, and i complained in the thread here. Then attempted to solve the problem. I couldnt. Since then I have worked a fair amount more at c++, So here I give you my fixes for the Priest Mage and Warlock bots.

This may NOT be how everyone else would want their bots to be BUT I cannot see why you would not want them this way.

What this fixes. Is Priests, Mages, and Warlocks will now no longer run in and melee mobs whatsoever ( I cannot think of a single case where a priest mage or warlock in close range combat is a good idea.)

What they will do now aside from that though is Ranged attack the target with an equipped wand. They will behave much the way Hunters do in that they will still cast all their spells. Priests will still heal. Just inbetween that they will continue to attack the target with their wand.

This can dramatically increase the DPS of a bot and also save them from many AOE attacks that they previously fell victim to.

Keep in mind these alterations were done on a R2 branch of mangos as thats what i was using when i wrote this. I am not 100% sure how they will integrate into current repo from blueboy. If there are problems let me know and ill reinsert it into a current pull.

http://pastebin.com/gMzJpcjg -- PlayerbotMageAI.cpp

http://pastebin.com/Dj2TCyh4 -- PlayerbotMageAI.h

http://pastebin.com/SUPphuns -- PlayerbotPriestAI.cpp

http://pastebin.com/LR9qCL0i --PlayerbotPriestAI.h

http://pastebin.com/8Wx8EJ3s -- PlayerbotWarlockAI.cpp

http://pastebin.com/siL7DDdW -- PlayerbotWarlockAI.h

Anyone who wants to test this out please feel free to and to post or Pm me any feedback.

*EDIT*

Wanted to add this in just so there were no misunderstandings.

The above text was not a message meant to indicate that I was upset with playerbot or blueboy or anything in that I complained and nothing was done. It was meant as encouragement to other people who have complaints or ideas to dive in and see if they can add anything to the project.

Link to comment
Share on other sites

Htrade: or Tradeskill Hlink

I've tried and tried to come up with a way to allow the bots to send a Profession Hlink that would allow you to open a tradeskill window and see their skills/recipes like it does between two

real players.. no luck. I'll offer up what I've dug around and come up with if anyone else wants to have a go at it.

Best I can tell:

shift+click on spell icon (or click the make a link button in tradeskill window)

Client runs a script producing an Hlink that contains the spell_id, current_skill, max_skill, player_guid, data including all the recipes that player knows.

since bots dont have a "client" this may not be possible, since your client is looking for certain information, in a certain way, to interpret.

Heres what I've found out so far. *BLUE* = my comments

From Internet source: Hlink data

trade (example: |cffffd000|Htrade:*spellId*45361:*currentSkill*339:*MaxSkill*375:*user_guid*60000000279E425:*UserData*Q/nPf6nprU3/n/fA8/Bw/PA+/B+/Aw/HA+/Bw/HA+5nfg////////P////HAAAQAA+DAAAAAAA|h[inscription]|h|r) - Represents the entire list of recipes for a character's trade skill or profession

From Mangos code:

Chat.cpp : // |color|Htrade:spell_id:cur_value:max_value:unk3int:unk3str|h[name]|h|r - client, spellbook profession icon shift-click

|cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r

// number or [name] Shift-click form |color|Htrade:spell_id,skill_id,max_value,cur_value|h[name]|h|r

I'm not sure if some of these examples are actually conflicting reports, or if the actual information needed for the link varies in how much is needed.

The following, if typed in chat, will return an appropriate Hlink for this, however, I haven't been able to create this link using code..

/run SendChatMessage("text here"..select(2,GetSpellLink(spell_id)).."text here as well", "CHANNEL", NIL, 2)

must be typed exactly as Ive put in blue here. Including all quotes, spaces(or lack thereof) and the text fields, even if they only contain a "."

This is a Script recognized by the client itself NOT mangos. As far as I can tell, this exact format must be used to the letter.

If used without the "select(2," section, it will only return the spell info. The second return is the one that makes the trade link.

"CHANNEL", NIL, 2 = the chat channel it gets sent to. I used 2 for example (trade channel)

there may be a simple solution. my knowledge of the code is minimal lol, so that accounts for alot.

My hunch is that without the last field (player data) it won't work. I've been able to create a link, using the information , spellId, skill, maxskill, (even tried guid), spell name,

but it doesn't work.

Anyway, wanted to toss this out there in case anyone else had thoughts of messing with it.

Link to comment
Share on other sites

I would like to see a modification that provides a crafting interface as well.

In addition, it gets rather annoying when the bot's items break and I get back to a armor/weaponsmith to repair items and find multiple missing. If a notification could be given as armor and weapons reach critical levels, that would be nice.

Link to comment
Share on other sites

I would like to see a modification that provides a crafting interface as well.

In addition, it gets rather annoying when the bot's items break and I get back to a armor/weaponsmith to repair items and find multiple missing. If a notification could be given as armor and weapons reach critical levels, that would be nice.

Thats a good idea macks.

Hadn't thought of about it, but something could be added to the AutoEquip function to check durability levels, and maybe even have them swap out worn items until they are repaired.

and then when you do repairs, have it check autoequip again to ensure the best items are back on again.

that shouldn't be too hard add in.

Link to comment
Share on other sites

Hi Guys,

@Gitch

Perhaps I didn't document these very well, but the ablity to view bot tradeskills and associated spell/recipes already exists.

To learn a tradeskill (2 primary skills per bot)

(from bot_readme.txt)

/t BOTNAME skill (lists all [PROFESSION LINK] bot Primary profession skills)

/t BOTNAME skill learn (lists [TRAINING LINK] available class, weapon & profession (Primary or Secondary) skills & spells, from selected trainer)

/t BOTNAME skill learn [TRAINING LINK] (learn selected skill or spell, from selected trainer)

/t BOTNAME skill unlearn [PROFESSION LINK] (unlearn selected primary profession skill & all associated spells)

Remember that [HLINK]s are selected by holding down the <Shift Key> and left clicking with the mouse

1. Select a suitable trainer with the bot closeby.

/w botname skill learn

The trainer will reply something like

I can teach you: // I know this is not word perfect, but you get the idea

[Apprentice BlackSmith]

To learn;

/w botname skill learn [Apprentice BlackSmith]

If the bot has the cost to learn the skill, there will be a 'black powder' flash and the skill will be learnt. Note that all associated spells are learnt in the same way.

To check which tradeskills a bot has

/w botname skill

[botname] Whispers: My Primary Professions: [blackSmithing]

2. To use these skills and view known abilities, you need to use the 'craft' command.

(from bot_readme.txt)

/t BOTNAME craft < alchemy | a > (List all learnt alchemy [RECIPE]..)

< blacksmithing | b > (List all learnt blacksmith [RECIPE]..)

< cooking | c > (List all learnt cooking [RECIPE]..)

< engineering | e > (List all learnt engineering [RECIPE]..)

< firstaid | f > (List all learnt firstaid [RECIPE]..)

< inscription | i > (List all learnt inscription [RECIPE]..)

< jewelcrafting | j > (List all learnt jewelcrafting [RECIPE]..)

< leatherworking | l > (List all learnt leatherworking [RECIPE]..)

< magic | m > (List all learnt enchanting [RECIPE]..)

< smelting | s > (List all learnt mining [RECIPE]..)

< tailoring | t > (List all learnt tailoring [RECIPE]..)

/t BOTNAME craft [RECIPE] (craft any recipe that consumes reagents)

/t BOTNAME craft [RECIPE] all (craft all instances of a particular recipe, indicated by it's [charge])

Knowing that the bot has blacksmithing as a tradeskill

/w botname craft <blacksmithing | b>

I know: [Copper Vest]

Will list all known blacksmithing spells/recipes learnt by the bot.

I make the item;

/w botname craft [Copper Vest]

If the bot has the relevant tool (BlackSmith's Hammer, has the raw materials i.e. Copper Bars, and close to an Anvil) the bot will create the item [Copper Vest].

If the bot needs raw materials too;

/w botname craft <smelt | s>

To smelt, the bot will also need to know Mining or trade the raw materials with a bot or player that does.

@macks

To view the item damage for a bot, use the 'stats' command. It doesn't list all damaged items, but does tell you the total cost to repair them.

Yes, Gitch has an good idea auto-replacing damaged items if the durability drops.

Hope this helps

Link to comment
Share on other sites

@blueboy,

right, I have all that down :D

What I was attempting is the ability , like with real players, to click that profession link, which is supposed to open 'their' tradeskill window on your screen,

so you can browse the recipes, etc using the UI.

It's not a necessity, just something I was trying to figure out.

And no i wasn't trying to out do your Crafting commands haha 8o

I have all the crafting commands macro'd and I wear them out regularly :lol:

It just bugged me that it seemed so simple to fix, yet... turned out its probably not doable anyway.

Looking for a place to stick durability check atm.

**Edit**

Running a few checks to confirm I've got a good spot for the code.

If it pans out, I'll insert the code to swap out/unequip worn items.

cancel the new function, found a solution

Link to comment
Share on other sites

Hi Gitch,

and everyone else I have responded to today. Sorry, it's been one of those days, which I should have taken off :/

I understand that it would be a nice idea to open dialog boxes on the client to service bots for various tasks, but it's not going to happen. The main problem is the system expects each player to have it's own world session and a screen to display it on. In theory you could get the system to open a window for the bot on the client, but you wouldn't see it. If you were to redirected the output to the player's session, you probably couldn't interact with it and it would almost certainly cause a crash. This is the reason why most command output is through the chathandler.

Cheers guys

Link to comment
Share on other sites

@blueboy,

Lol, take a breather guy :)

I know what you mean. I got up 2 hours early this morning because I had to be somewhere , and when I got there they were

an hour late opening.... The day has followed suit haha.

But yeah, I'm perfectly fine with the chat system, its flexible, and much more expandable than the UI itself (from a server stand point)

I actually have the profession link working since its only a Hlink from the sender and operates on the receiving client,

the prob is I have to have the bot force it with an explicit ID etc.. which is useless.

anyway, hope yer day goes better. borrowed some ideas from repair expense function. ]:D

Link to comment
Share on other sites

nah its more than that really, the only way its worked was to actually send exact infos like.. the spell number, etc.

it has to do with the way the client reads the dbc I think.

making progress on unequipping worn items. I'm thinking unequip at between 5-10% of max.

Link to comment
Share on other sites

blueboy: I wasn't aware of the "craft" command. Oops. I've read the docs, but missed it. I keep logging into the character to do crafting /sillyme

Today's update to playerbot includes something that breaks the merge in win/VC100/game.vcxproj.filters, but since I'm not using VS, it doesn't affect me.

Hello Fellow Playerbot Enthusiasts!

Well A long time ago I had a complaint about playerbot, and i complained in the thread here. Then attempted to solve the problem. I couldnt. Since then I have worked a fair amount more at c++, So here I give you my fixes for the Priest Mage and Warlock bots.

This may NOT be how everyone else would want their bots to be BUT I cannot see why you would not want them this way.

What this fixes. Is Priests, Mages, and Warlocks will now no longer run in and melee mobs whatsoever ( I cannot think of a single case where a priest mage or warlock in close range combat is a good idea.)

Where exactly do these files go? I don't have anything called priest.h (or Priest.h) to modify or replace with your code. Would love to test it out though.

EDIT: It looks like the file is named PlayerbotPriestAI.h.

Link to comment
Share on other sites

Yes they are named PlayerbotpriestAI.cpp and playerbotpriestAI.h, playerbotmageAI.cpp, playerbotmageAI.h, playerbotwarlockAI.cpp, playerbotwarlockAI.h respectively. I only named the files that so you could see which one was meant to replace which file. Sorry for the confusion.

I updated initial post to reflect what files they are supposed to replace now. Thanks for pointing that out

http://www.mediafire.com/?41103e1iicdr4j5 (It is zipped with 7Zip) Winrar or 7zip will unzip it.

Here is a mediafire link to the files themselves. So you can just download the 11kb file from this link and then copy them to your playerbot directory if you would like.

Link to comment
Share on other sites

Found a couple problem spots in AutoEquip.

fixed them, and am working out some kinks in the worn equipment section.

Going to do some more tidying up as well. Should have something later, including adjustments in the

stat comparison code (had a few problems there as well).

Bots were sending their "which reward should I take" quest text, twice... Looking at that too, anyone else notice it?

Link to comment
Share on other sites

Hi Gitch,

I found some more information on the trade HLINK. I'm sure whether it will help any

UI escape sequences

To examine the HLINKs using the playerbot code

First, At line ~ 6850 in PlayerbotAI.cpp uncomment the following line

// DEBUG_LOG("chat(%s)",text.c_str());

Then rebuild code and send a dumby command to the bot chat handler ([Cooking] link from player spellbook)

/p cast <SHIFT><LEFT CLICK>[Cooking]

chat(cast |cffffd000|Htrade:2550:1:75:80000084:HAAAAABAEAAAAAAAAAAAAAAAAAAAAAA|h[Cooking]|h|r)

These recipe are initially learnt with the cooking skill

Herb Baked Egg

Roasted Boar Meat

Charred Wolf Meat

After learning Spiced Bread the recipe list looks like this

chat(cast |cffffd000|Htrade:2550:1:75:80000084:HAAAAABAEAAAAAAQAAAAAAAAAAAAAAA|h[Cooking]|h|r)

According to the link above, the recipe list is a Base64 encoded string, presumably using a custom inhouse algorithm. I tried a direct conversion from Base64 to ASCII and got only garbage.

Cheers

Link to comment
Share on other sites

Hi blueboy,

appreciate that.

sounds like more work than it'd b worth =)

good to know about the debug tip! Fine tuning some things and looking for any loose ends with the unequip for worn items.

***Edit***

I've learned a hard lesson about digging into too many things at one time..

found a bunch of functions I was interested in, and was copy pasting, and..

my machine lagged a bit when I moused over the data base browser accidentally..

and I moved an entire section of code and had to straighten it out..

Right in the middle of code I've been working with since yesterday lol so no back up atm..(there will be now)

I have chat response for worn items working great , and a 10% of max durability trigger working as well.

Just fitting it all in. Going to test this a good bit before pushing anything.

On a side note: has there been anything done for playerbot like.. well.. like chat between bots now and then,

the occasional burn or just yakking?

Was thinking what it would be like to give the bots a bit of personality (and let you pick their personality since its yer bots)

Just a thought. (I'm a Morrowind Mod freak haha)

Link to comment
Share on other sites

Hi Guys,

Something must have been going right yesterday.

If you still have problems, wait until 'movemaps' is integrated into the core

I must have had a crystal ball. Anyway, I have now updated all the repos and also the 'new-ai' branch with the latest core and with MoveMaps Yaaah..

Hope this helps

Link to comment
Share on other sites

Yay!

Glad something is going right!

I'm having a devil of a time with worn item code.. but working on it.

between compile times, and REcompile times due to the silliest errors on my part, I'm almost bald :lol:

VC++ 2008 needs a compile error that says:

"okay look, I compiled this garbage for ya, but you told Bob to pick Dougs pocket... fine.. but you might want to make sure Doug has pockets,

or there could be problems.."

My forgetter works better than my rememberer

**Edit**

do you guys use any other forum for playerbot?

Would be handy to be able to separate threads by topic/branch/updates etc. Just a thought! O:)

Maybe we could kiss up to an admin and get a new category for playerbot development with a few sub categories for branch updates/ general discussion etc...

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