Jump to content

Playerbot (archive)


Recommended Posts

Hi sunnyqeen,

Thanks for the patch. I agree that it would nice for the bots to learn new flight nodes, even if the master is only enquiring about flight. It is important to use an opcode that will only be triggered when the player selects the flightmaster. I have checked the incoming opcodes stream, as the player activates the flightmaster and I get CMSG_GOSSIP_HELLO and CMSG_TAXINODE_STATUS_QUERY (the opcode CMSG_TAXIQUERYAVAILABLENODES is not sent).

CMSG_TAXINODE_STATUS_QUERY is not suitable, as it is not triggered by flightmaster activation. It is triggered if the player gets near to a flight node (i.e every node during flight, so the bots would learn new nodes as they flew :|).

The only possibility would be to use the CMSG_GOSSIP_HELLO opcode. The problem here is that it's a general opcode used for any NPC activation. If we were to utilize this, it would be necessary to make the code adaptable for other types of NPC. I have modified the code in your patch to make it more granular, to allow for this.

I also found that currently CMSG_GOSSIP_HELLO & CMSG_QUESTGIVER_HELLO are not being used correctly, to enable bots to turn in quests. CMSG_QUESTGIVER_HELLO does not appear to be sent at all, when the player turns in a quest. Further with CMSG_GOSSIP_HELLO, bots were checking all NPCs selected by the player. I have replaced these with CMSG_QUESTGIVER_COMPLETE_QUEST instead. I have included several dumby options for you to test the codes functionality. You can remove these if not required or just comment them out.

I will update the flight branch shortly, but here is the revised patch for you to try;

EDIT: Since posting the patch below, I have found problems with bots turning in quests, as the player does. The problem stems from the use of CMSG_QUESTGIVER_COMPLETE_QUEST. I realise now, that CMSG_QUESTGIVER_HELLO is the best way, and I will update the flight branch accordingly.

diff --git a/src/game/playerbot/PlayerbotMgr.cpp b/src/game/playerbot/PlayerbotMgr.cpp
index 07b9be8..25622b5 100644
--- a/src/game/playerbot/PlayerbotMgr.cpp
+++ b/src/game/playerbot/PlayerbotMgr.cpp
@@ -401,9 +401,7 @@ void PlayerbotMgr::HandleMasterIncomingPacket(const WorldPacket& packet)
        }
        break;

-        // if master talks to an NPC
-        case CMSG_GOSSIP_HELLO:
-        case CMSG_QUESTGIVER_HELLO:
+        case CMSG_QUESTGIVER_COMPLETE_QUEST:
        {
            WorldPacket p(packet);
            p.rpos(0);    // reset reader
@@ -501,6 +499,76 @@ void PlayerbotMgr::HandleMasterIncomingPacket(const WorldPacket& packet)
            }
            return;
        }
+        // Handle GOSSIP activate actions, prior to GOSSIP select menu actions
+        case CMSG_GOSSIP_HELLO:
+        {
+            DEBUG_LOG("PlayerbotMgr: Received CMSG_GOSSIP_HELLO");
+
+            WorldPacket p(packet);    //WorldPacket packet for CMSG_GOSSIP_HELLO, (8)
+            ObjectGuid guid;
+            p.rpos(0);                //reset packet pointer
+            p >> guid;
+
+            for (PlayerBotMap::const_iterator it = GetPlayerBotsBegin(); it != GetPlayerBotsEnd(); ++it)
+            {
+                Player* const bot = it->second;
+                if (!bot)
+                    return;
+
+                Creature *pCreature = bot->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
+                if (!pCreature)
+                {
+                    DEBUG_LOG("PlayerbotMgr: HandleGossipHelloOpcode - %s not found or you can't interact with him.", guid.GetString().c_str());
+                    return;
+                }
+
+                GossipMenuItemsMapBounds pMenuItemBounds = sObjectMgr.GetGossipMenuItemsMapBounds(pCreature->GetCreatureInfo()->GossipMenuId);
+                for(GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr)
+                {
+                    uint32 npcflags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS);
+
+                    if (!(itr->second.npc_option_npcflag & npcflags))
+                        continue;
+
+                    switch(itr->second.option_id)
+                    {
+                        case GOSSIP_OPTION_TAXIVENDOR:
+                        {
+                            bot->GetPlayerbotAI()->TellMaster("PlayerbotMgr:GOSSIP_OPTION_TAXIVENDOR");
+                            bot->GetSession()->SendLearnNewTaxiNode(pCreature);
+                            break;
+                        }
+                        case GOSSIP_OPTION_VENDOR:
+                        {
+                            bot->GetPlayerbotAI()->TellMaster("PlayerbotMgr:GOSSIP_OPTION_VENDOR");
+                            break;
+                        }
+                        case GOSSIP_OPTION_STABLEPET:
+                        {
+                            bot->GetPlayerbotAI()->TellMaster("PlayerbotMgr:GOSSIP_OPTION_STABLEPET");
+                            break;
+                        }
+                        case GOSSIP_OPTION_AUCTIONEER:
+                        {
+                            bot->GetPlayerbotAI()->TellMaster("PlayerbotMgr:GOSSIP_OPTION_AUCTIONEER");
+                            break;
+                        }
+                        case GOSSIP_OPTION_BANKER:
+                        {
+                            bot->GetPlayerbotAI()->TellMaster("PlayerbotMgr:GOSSIP_OPTION_BANKER");
+                            break;
+                        }
+                        case GOSSIP_OPTION_INNKEEPER:
+                        {
+                            bot->GetPlayerbotAI()->TellMaster("PlayerbotMgr:GOSSIP_OPTION_INNKEEPER");
+                            break;
+                        }
+                    }
+                }
+            }
+            return;
+        }
+    
        case CMSG_REPAIR_ITEM:
        {

@@ -840,7 +908,8 @@ void PlayerbotAI::GetTaxi(ObjectGuid guid, std::vector<uint32>& nodes)
      }

      if(m_bot->m_taxi.IsTaximaskNodeKnown(nodes[0]) ? 0 : 1)
-          m_bot->GetSession()->SendLearnNewTaxiNode(unit);
+          return;
+      //    m_bot->GetSession()->SendLearnNewTaxiNode(unit);

      if(m_bot->m_taxi.IsTaximaskNodeKnown(nodes[nodes.size()-1]) ? 0 : 1)
          return;

The later part of this patch (@@ -840,7 +908,8 @@ void PlayerbotAI::GetTaxi) is only necessary if you are using the code from the flight branch.

Thanks for your interest in playerbot and for drawing these issues to my attention.

Hope this helps

Link to comment
Share on other sites

  • Replies 1.8k
  • Created
  • Last Reply

Top Posters In This Topic

hey blueboy thx for your hard work its amazing :).. we got that bots can use flight,vendor,proffesions.. can you now try to make that bots can go bg/arena

I have been asked about bg/arena before and I am aware of yad's work mentioned by vladex. I believe the best course of action would be to first allow yad the develop stable code for this and then we will try to get both projects to work together. If anyone would like to tackle this as a project with playerbot, please raise your hands now :D

Link to comment
Share on other sites

Hi Guys,

I would first like begin by encouraging you to use the superb code on the loot-fix-bt branch, developed by BThallid. This takes bot looting & gathering to the next level and is a vast improvement over what was. Interestingly, a recent addition to this code (SMSG_INVENTORY_CHANGE_FAILURE handler) has enabled me to highlight a bug in the existing looting code, presently on portal.

Issue:

bots were not looting corpses properly. Items, including quest items were being left behind, although the bots had the capacity and need for these items. The SMSG_INVENTORY_CHANGE_FAILURE handler sends a warning to the client, each time an item is left behind.

That is already looted.

Cause:

The SMSG_LOOT_RESPONSE packet was not unpacked correctly in the switch option, included in the function HandleBotOutgoingPacket(). This led to data corruption and erroneous item information.

Solution:

WorldPacket p(packet); // (8+1+4+1+1+4+4+4+4+4+1) representation of how the packet is composed, with data sizes

ObjectGuid or uint64 data size 8

uint32 data size 4

uint8 data size 1

Before fix:

p >> guid; // 8 corpse guid

p >> loot_type; // 1 loot type

p >> gold; // 4 money on corpse

p >> items; // 1 number of items on corpse

The remaining data is unique to each lootable item, and was not being used. So as each bot loots, the data becomes more and more confused.

            if (loot_type == LOOT_SKINNING || HasCollectFlag(COLLECT_FLAG_LOOT))
               for (uint8 i = 0; i < items; ++i)
               {
                   // just auto loot everything for getting object
                   WorldPacket* const packet = new WorldPacket(CMSG_AUTOSTORE_LOOT_ITEM, 1);
                   *packet << i;
                   m_bot->GetSession()->QueuePacket(packet);
               }

After fix:

p >> guid; // 8 corpse guid

p >> loot_type; // 1 loot type

p >> gold; // 4 money on corpse

p >> items; // 1 number of items on corpse

The following Loops for each item on the corpse

p >> itemindex; // 1 counter

p >> itemid; // 4 itemid

p >> itemcount; // 4 item stack count

p.read_skip<uint32>(); // 4 item model

p.read_skip<uint32>(); // 4 randomSuffix

p.read_skip<uint32>(); // 4 randomPropertyId

p >> lootslot_type; // 1 slot 0 = can get, 1 = look only, 2 = master get

The data is now processed correctly and all items are lootable.

I will be updating the code on portal shortly.

Hope this helps

Link to comment
Share on other sites

With all the branches accumulating in portal, I'm at a loss as to how they all fit together.

Can I simply fetch and then merge all the branches to have a complete feature set or is it recommended to use one particular branch? Would I be better off waiting until the playerbot master repo has the branches from portal added?

side note:

--------------

Perhaps it might be best to start a new playerbot thread, blueboy, so you may keep the initial post updated with current information. After the time that has passed since you took up working on playerbot, I really don't think collinsp will be returning to the project. You're no longer a mere custodian so it's only fitting to have a thread that belongs to you.

Link to comment
Share on other sites

Hi UnkleNuke,

I agree that the playerbot thread is now a vast tome. I am not personally interested in the thread belonging to me, but I can see some problems in starting a new thread. As I didn't start the original thread, I cannot close it. If I was to created a new thread, what would I call it, other than "Playerbot". With two threads open, support would become confused, as users would invariably post either thread, asking questions that may have already been answered. Also, if the existing thread was to be closed, someone @ getmangos.eu might even feel it would be a good idea to delete it, to free up space :o

I prefer to create and apply standalone patches as you know, from the various branches, but I know that this is not always possible.

BThallid has done extensive work on the loot-fix-bt branch. During the course of his work, he has the merged code several times with portal. As such it is not possible to create a (full) snapshot patch, that contains only loot-fix-bt code. If you were to use one branch as a base, I would suggest you use this one. Then merge all others with this e.g portal or MaNGOS. It is possible to create snapshot patches from all other alpha branches and this is what I suggest you do (some branches e.g sharedbots and flight exist with core code before the recent 'cmake build' changes. A merge would result in conflicts. Easily fixed, but why make life complex). Standalone snapshot patches are more or less independant of the core version.

I include below a general bash script that will help create a snapshot patch, without core code (note: The patch will includes all code changes, after the last merge). Just replace flight in the script with the name of the required branch and apply the created patch to your base code.

#!/bin/bash -x
git clone git://github.com/mangos/mangos.git flight
cd flight
git fetch git://github.com/blueboy/portal.git flight:flight 
git checkout flight 
HASH=`git log --pretty=oneline | grep -m 1 'Merge branch' | cut -d " " -f 1`
git diff $HASH > flight.patch

Hope this helps

Link to comment
Share on other sites

Thanks for your advice and the Bash script, blueboy. That's why you're one of the best. :)

I'm not sure of I can run that script using msysgit's Bash under WinXP, but pulling the branches by hand isn't too tedious.

I'd suggest you speak with TheLuda or another forum admin about renaming this thread something like Playerbot (Old) so you can keep the Playerbot name for your own thread. This would reduce any confusion to a minimum, aside from those who probably can't type and chew gum at the same time anyways, the same ones that keep posting questions about 4.x.x core support. :lol:

If I can, I'll try to cherry-pick the commits from loot_fix_bt to create a standalone diff for everyone, to help eliminate merge conflicts.

Link to comment
Share on other sites

A small question, take example as flight, alpha means it is tested by everybody, when it is in beta (accepted ?) do you merge it in your branch or main portal ?

alpha (portal branches) High risk code still in early development (minimal support, feedback for dev info only).

beta (portal master) Public test stage, code in the later stage of development (full support)

release (blueboy master) Fully tested code (full support)

alpha branches are merged into portal master, and once tested portal master is merged into blueboy master

Link to comment
Share on other sites

I'm not sure of I can run that script using msysgit's Bash under WinXP, but pulling the branches by hand isn't too tedious

I use the bash script on WINXP, using the git shell. The only issue you might get is with the 'grep.exe' included with the shell. If it is an old version it might not know the '-m' option. I replaced this with a version from GNU that does.

blue:~ # grep -V

GNU grep 2.5.4

====================

Output control:

-m, --max-count=NUM stop after NUM matches

Failing that, speak with me on PM.

Cheers

Link to comment
Share on other sites

I started the thread. Let me know if there is anything I can do (update the first post). I don't see a way to reassign the post to someone else. I wish I had more time to devote to development. Someday I'd like to continue what I started.

Hi,

Great to see your still around. I understand about time constraints, there are never enough hours in the day.

My only real worry about starting a new thread is that someone might delete the old thread to free up space. This topic is still open for discussion and we would be grateful for any assistance you give, once a decision has been made.

We are just looking after the shop, until you get back ;)

Link to comment
Share on other sites

I'll second blueboy's sentiments. It is good to see you posting here again, collinsp. :)

I hope the day does come soon when you can once again join in with developing more code.

Between the talents of both you and blueboy, Playerbot could grow so complex it would make mere human players redundant. :lol:

@blueboy:

I don't think your fears of losing the wealth of information in this thread are cause for great worry. The MaNGOS crew aren't in the habit of deleting old threads that have historical significance. At the very least, a deletion would not happen until new development makes the information contained here obsolete to the point of useless and I doubt the old topic would be done away with even then.

But that is something for you and collinsp to work out. It was merely a suggestion on my part to try and keep things tidy.

Link to comment
Share on other sites

Hi Guys,

I've just added a new alpha branch called talents. As the name suggests, the code enables the player to manage the bot talents. The initial patch allows you to display all active talents for bots (no big deal, 'inspect' does this too), but it also shows active glyphs for the bots.

Handle talents & glyphs:

talent -- Lists bot(s) active talents & glyphs

/w <botname> talent

/p talent

Rogue character

[Cheryl] whispers:

Active Talents [improved Eviscerate][Deflection][improved Slice and Dice]

[Dual Wield Specialization][improved Sinister Strike][improved Gouge]

[Close Quarters Combat][Master of Deception] Unspent points : 3

Active Glyphs [Glyph of Exposed Armour][Glyph of Blurred Speed]

Paladin character

[Xena] whispers:

Active Talents [impale][improved Heroic Strike][Anger Management]

[improved Charge][improved Rend][Deflection][Cruelty][Armored to the Teeth]

[incite][shield Specialization][improved Thunder Clap] Unspent points : 0

Acitive Glyphs [Glyph of Resonating Power][Glyph of Charge]

<click> on an [HLINK] will display the tooltip for the talent or glyph.

talent learn [HLINK][HLINK] .. -- Learn selected talent from bot 'inspect' (shift click icon).

/w <botname> talent learn [HLINK][HLINK]..

You can select a new talent to learn from bot 'inspect' window, <shift click> on the appropriate icon. If you require a known talent to be updated to a higher rank, you can either use bot 'inspect', as above or <shift click> on the appropriate [HLINK] displayed by the bot 'talent' command.

/w xena talent learn [shield Specialization]

will do nothing as xena has no 'Unspent talent points'. If she did, the [shield Specialization] would increase in rank by one.

Known issue: If the bot 'inspect' client window is open when you learn a talent, it will not be updated until you close and then reopened it. Please note that the spell is learnt correctly, it's just that the open window will not refreshed. After learning a new talent, all talents are displayed again in the chat history, with the updated 'Unspent talent points'.

Hope this helps

Link to comment
Share on other sites

I updated the first post. Feel free to post edits.

The only thing I would change would be with 'Active Repositories'

blueboy was forked from the original playerbot Github, and contains the most stable code.

https://github.com/blueboy/mangos

portal contains our beta code, includes the latest features, but is still under test.

https://github.com/blueboy/portal

EDIT:

Have you got any thoughts on what is to become of the original playerbot Github. When rrtn left the scene, nobody was left on the collaborators list who could update it. Maybe we could use it as the site for our stable code and use blueboy Github for development only.

Cheers

Link to comment
Share on other sites

Hi Guys,

In response to recent events, I propose the following changes to playerbot. Please feel free to comment.

New Github code Layout:

Thanks to collinsp, I have been added to the owner's team for the original playerbot Github. I wish now to update this and maintain it for playerbot release code. The blueboy Github will be used solely for playerbot development. I hope you agree with me that this makes sense.

New Playerbot thread:

I will first ask the management to rename the existing thread to Playerbot (Archive) and it will be closed. As the originator of Playerbot, I will then ask collinsp to start a new thread, providing the first post.

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