Jump to content

Playerbot


Recommended Posts

Playerbot lets you login your other characters from your account as bots that can be controlled to automate combat, facilitate trade, accept quests, complete quests, handle movement, manage inventory, and much much more...

More Information can be obtained from the Playerbot Wiki

This is a community project and all contributions are welcome. I would like to acknowledge the hard work of all those who have previously contributed and made playerbot what it is today

Cheers

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 799
  • Created
  • Last Reply

Top Posters In This Topic

PlayerbotAI fix:

If the player is unmounted, when add a mounted bot, the bot will not change it's mounted status.

If the player and bots are mounted, and the bots is under attacked, the bot will stoped following the player.

diff --git a/src/game/playerbot/PlayerbotAI.cpp b/src/game/playerbot/PlayerbotAI.cpp
index 12d9dbb..40c45b3 100644
--- a/src/game/playerbot/PlayerbotAI.cpp
+++ b/src/game/playerbot/PlayerbotAI.cpp
@@ -2827,14 +2827,25 @@ void PlayerbotAI::UpdateAI(const uint32 p_time)
            m_spellIdCommand = 0;
            m_targetGuidCommand = 0;
        }
+        
+        //if master is unmounted, unmount the bot
+        else if (!GetMaster()->IsMounted() && m_bot->IsMounted())
+        {
+            WorldPacket emptyPacket;
+            m_bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);  //updated code
+        }

        // handle combat (either self/master/group in combat, or combat state and valid target)
        else if (IsInCombat() || (m_botState == BOTSTATE_COMBAT && m_targetCombat))
-        {
-            if (!pSpell || !pSpell->IsChannelActive())
-                DoNextCombatManeuver();
-            else
-                SetIgnoreUpdateTime(1);  // It's better to update AI more frequently during combat
+        {   
+           //check if the bot is Mounted
+           if (!m_bot->IsMounted())
+           {
+                if (!pSpell || !pSpell->IsChannelActive())
+                    DoNextCombatManeuver();
+                else
+                    SetIgnoreUpdateTime(1);  // It's better to update AI more frequently during combat
+            }
        }
        // bot was in combat recently - loot now
        else if (m_botState == BOTSTATE_COMBAT)

Link to comment
Share on other sites

New Feature: Direct bot & NPC interaction :D

I have created a new function findNearbyCreature() that facilitates bot & NPC interaction for a number of purposes.

Each bot will maintain it's own itemlist (m_itemIds). The list is a series of item pairs, the first component of the pair (UNIT_NPC_FLAG) dictates what is to be done with the item (uint32 itemid) given as the second component.

e.g m_itemIds list

VENDOR_MASK, 925 // sell item 925

VENDOR_MASK, 1427 // sell item 1427

UNIT_NPC_FLAG_AUCTIONEER, 925 // auction item 925

VENDOR_MASK, 750 // sell item 750

while ( m_itemIds is not empty )

{

bots will scan for all relevant NPC's within range (findNearbyCreature()), that can service the list.

if ( NPC found )

bot will move to the NPC location, who will service all list entries, relevant to that NPC.

}

Initially, this has been developed to handle the sale of bot items with vendors, but it will be extended to realise bot interaction with auctionhouses.

I will shortly push a working patch, to the alpha branch vendor

@sunnyqeen

Thanks for the patch, it works a treat :D I will shortly push it to portal

Hope this helps

Link to comment
Share on other sites

Hi,

If you require help compiling playerbot with the core, you must give me more information. Your message tells me very little,

slight little compile problem with latest core modification

Minimum info required

1. your server platform (windows or *nix)

2. version of playerbot being used

3. version of core being used

4. any other mods used

5. any debug info on runtime or compile errors

I am using linux. I have just compiled the latest code from portal master (pushed 3 hours ago) with the latest core MaNGOS[11321]. It compiles and runs without issue. I am also running movemaps, ahbot from blueboy and the following alpha branch mods (loot-fix-bt and vendor).

Please let me know what compile issues you get.

Link to comment
Share on other sites

Now we have NPC interaction with plans for automatic auction house interaction, too?

Just waiting on that automatic login patch so I can sit back and drink my coffee while I watch my bots play for me! :lol:

You're all absolutely brilliant! Way to go Playerbot team! ;)

Link to comment
Share on other sites

Now we have NPC interaction with plans for automatic auction house interaction, too?

Just waiting on that automatic login patch so I can sit back and drink my coffee while I watch my bots play for me! :lol:

You're all absolutely brilliant! Way to go Playerbot team! ;)

I have the auction patch ready and I will be pushing it shortly. In the meantime, I have just pushed the sell patch to vendor

Hope this helps

Link to comment
Share on other sites

thx for fast answer... got 1 more question.... if i wanna use a mangos core with your ahbot patch and playerbot... do i only need to git clone your https://github.com/playerbot/mangos and compile?

You can do, but it's more flexible to create standalone patches and create a server to your own design

1. git clone git://github.com/mangos/mangos.git

2. then apply each of the mod patches in turn (playerbot, ahbot, etc ..)

playerbot and ahbot from blueboy will merge without conflict.

Here is the bash script to create the ahbot patch

#!/bin/bash -x
git clone git://github.com/mangos/mangos.git ahbot
cd ahbot
git fetch git://github.com/blueboy/ahbot.git ahbot:ahbot
git checkout ahbot
HASH=`git log --pretty=oneline | grep -m 1 '\\[1[0-9]\\{4\\}]' | cut -d " " -f 1`
git diff $HASH > ahbot.patch

hope this helps

Link to comment
Share on other sites

Hi Guys,

I've just pushed the 'auction' patch to the vendor branch. This is the initial version, so it's a bit rough around the edges. It works much the same as the sell command except the bot(s) look for auctioneers rather than vendors. All you can do a present is create an auction for the bot(s).

Used in conjunction with the 'auctionhousebot' patch you can get the auctionhousebot to bid and even buyout the bot(s) items, if the price is right. I would be grateful for feedback on this point. The values for starting bid and buyout price are only approximated. If anyone want to provide a concise algorithm to calculate these values, I would appreciate it. Anyway enjoy.. :D

Hope this helps

Link to comment
Share on other sites

Relating to your AHBot patch, blueboy...

Wouldn't it be possible to "update" the code in a manner similar to cyberium's work, where an NPC is used for the AHBot?

I know cyberium did initially release a patch that did just that with the Naicisum/xeross code. It only removed the need for a player account to create the bot and replaced it with an NPC. Nothing else in the code base was changed, to the best of my knowledge.

Or would doing so break some of the features between the PB AHBot and Playerbot?

Link to comment
Share on other sites

Wouldn't it be possible to "update" the code in a manner similar to cyberium's work, where an NPC is used for the AHBot?

I know cyberium did initially release a patch that did just that with the Naicisum/xeross code. It only removed the need for a player account to create the bot and replaced it with an NPC. Nothing else in the code base was changed, to the best of my knowledge.

Or would doing so break some of the features between the PB AHBot and Playerbot?

All things are possible :D I am not totally familiar with cyberium's 'new_ahbot' that is under review (I know I should), and hopefully it won't be too before it's in the core. However, I understood the reason for removing the bot from the code, was to free up resources; without the need to create a dedicated ahbot character and associated account. I assume that the 'new_ahbot' code emulates the bot, in stocking and purchasing items to and from the auctionhouse. If this is so, my code will work with both, without any need for alteration. Playerbot auctions are added to the auctionhouse exactly the same as a real player would do, and processed the same way too. If the auction is won or expires, an email is sent to the bot.

I am presently working on a revision to the initial code that will allow bots to not only add auctions, but also to list those bot owned auctions, and remove any unwanted bot auctions. Playerbot bidding is not practical at present.

Hope this helps

Link to comment
Share on other sites

Relating to your AHBot patch, blueboy...

Wouldn't it be possible to "update" the code in a manner similar to cyberium's work, where an NPC is used for the AHBot?

I know cyberium did initially release a patch that did just that with the Naicisum/xeross code. It only removed the need for a player account to create the bot and replaced it with an NPC. Nothing else in the code base was changed, to the best of my knowledge.

Or would doing so break some of the features between the PB AHBot and Playerbot?

Sorry, I misunderstood. Your referring to the repository ahbot @ blueboy Github. I have no plans to alter the code here. It works and provides adequate auctionhouse capabilities for playerbot development. As mentioned in my last post, it would be silly to create a new flavour of ahbot, when everyone anticipates cyberium's ahbot being included in the core, sooner or later.

Hope this helps

Link to comment
Share on other sites

not sure if this will work or not on core 11339 Getting patch error on src/game/worldsession.cpp;421

@@ -421,7 +467,8 @@ void WorldSession::LogoutPlayer(bool Save)
        ///- Reset the online field in the account table
        // no point resetting online in character table here as Player::SaveToDB() will set it to 1 since player has not been removed from world at this stage
        // No SQL injection as AccountID is uint32
-        LoginDatabase.PExecute("UPDATE account SET active_realm_id = 0 WHERE id = '%u'", GetAccountId());
+        if (! _player->GetPlayerbotAI())
+            LoginDatabase.PExecute("UPDATE account SET active_realm_id = 0 WHERE id = '%u'", GetAccountId());

        ///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
        if (Guild *guild = sObjectMgr.GetGuildById(_player->GetGuildId()))

///- Reset the online field in the account table
       // no point resetting online in character table here as Player::SaveToDB() will set it to 1 since player has not been removed from world at this stage
       // No SQL injection as AccountID is uint32
       static SqlStatementID id;

       SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE account SET active_realm_id = ? WHERE id = ?");
       stmt.PExecute(uint32(0), GetAccountId());

       ///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
       if (Guild *guild = sObjectMgr.GetGuildById(_player->GetGuildId()))

Link to comment
Share on other sites

Hi

Thanks very much for the patch. This is more or less what I did to fix recent changes with the core. After MaNGOS[11317], changes to include 'prepared sql statments' caused a few conflicts with playerbot code in WorldSession.cpp.

@@ -467,8 +467,13 @@ void WorldSession::LogoutPlayer(bool Save) 
        ///- Reset the online field in the account table 
        // no point resetting online in character table here as Player::SaveToDB() will set it to 1 since player has not been removed from world at this stage 
        // No SQL injection as AccountID is uint32 
+        static SqlStatementID id; 
+ 
        if (! _player->GetPlayerbotAI()) 
-            LoginDatabase.PExecute("UPDATE account SET active_realm_id = 0 WHERE id = '%u'", GetAccountId()); 
+        { 
+            SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE account SET active_realm_id = ? WHERE id = ?"); 
+            stmt.PExecute(uint32(0), GetAccountId()); 
+        } 

        ///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members 
        if (Guild *guild = sObjectMgr.GetGuildById(_player->GetGuildId())) 


@@ -543,8 +548,11 @@ void WorldSession::LogoutPlayer(bool Save) 
        WorldPacket data( SMSG_LOGOUT_COMPLETE, 0 ); 
        SendPacket( &data ); 

+        static SqlStatementID updChars; 
+ 
        // Playerbot mod: commented out above and do this one instead 
-        CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE guid = '%u'", guid); 
+        SqlStatement stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 0 WHERE guid = ?"); 
+        stmt.PExecute(guid); 

        DEBUG_LOG( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" ); 
     } 

I have committed these changes to portal in the last merge. I have been working with the adjusted code and it appears to work without issue.

Sorry, I have been distracted by development work on the 'auction.patch'; this is now ready to commit to vendor. Once done, I will then check whether there are any further problems with playerbot and MaNGOS[11339]+.

Hope this helps

Link to comment
Share on other sites

Hi Guys,

Before committing the 'auction.patch' revision to vendor, I thought it might be useful to provide a brief primer on it's use.

To 'create' a bot auction

We first need to get a list of all items in the bot inventory, in [item Link] form.

Select 'Trade' from the bot avatar menu on the client and then close the trade dialog that opens.

Click on the [botname] HLINK to open chat with botname.

Tell botname: auction add [item Link][item Link]...

The items will be added to the bot m_itemIds list.

While(m_itemIds not empty)  
{
     bot will scan for surrounding creatures (findNearbyCreature()) who can service m_itemIds
     if(found)
         Search is carried out for all itemids that can be processed by this creature.
         if(processed successfully)
             This instance of the data pair (npcflag,itemid) will be removed from m_itemIds
}

If the auction is created successfully, the master is notified.

To 'list' all active bot auctions

Tell botname: auction

A dumby item is added to the bot m_itemIds list, purely to locate the nearest auctioneer. Once found, all active bot auctions are listed (Please noted that location of the nearest auctioneer will only be acheived, if the bot is within range of the auctioneer).

[botname] whispers: My active auctions are:

[Gold Bar] AHBot: 73s 47c end: 19H 7min

[Heavy Stone] ends 5H 34min

Primarily an [Auction Link] is displayed.

If(anyone has bidded on the bot auction)
   Their 'name' and 'bid' will also be displayed, together with the auction 'time' remaining.
else
   Remaining auction 'time' will be displayed.

To 'cancel' active bot auctions

Using the [Auction Link] displayed by 'list' (shift click on the link)

Tell botname: auction remove [Gold Bar][Heavy Stone]...

The auction ids are first extracted from the links and then added to the bot m_auctions list.

A dumby item is also added to the bot m_itemIds list to locate the nearest auctioneer. Once found, all active auctions in m_auctions (with ActionFlags == REMOVE) will be removed.

If the auction cancellation is successfully, the item(s) will be returned to the bot via email and the master will be notified.

I will push the changes to vendor shortly

Hope this helps

Link to comment
Share on other sites

A small suggestion (I do not know if the modality is thought)

when you have a repair robot, you can repair but none of your bots

it will be nice :)

Thanks for the suggestion. This has been requested before and I am presently revising the code to hopefully accommodate it. Field repair bots possess the npcflags of a repairer (UNIT_NPC_FLAG_ARMORER) & vendor (UNIT_NPC_FLAG_VENDOR). The idea is that the repair bots will be treated just like any other npc, so the playerbots should be able to interact with them

Hope this helps

Link to comment
Share on other sites

compîle problem on windows

Auto-merging src/game/CharacterHandler.cpp
CONFLICT (content): Merge conflict in src/game/CharacterHandler.cpp

mangos version : [11355]

using git://github.com/blueboy/portal.git master

They have recently renamed some enums in the core and this was what caused the conflict. I have now corrected this on portal with a merge MaNGOS[11357]. I will be updating the other repos shortly.

Hope this helps

Link to comment
Share on other sites

Hi Guys,

In response to mrelfire's suggestion I have created a new method for bots to repair their items. This is far more comprehensive than the existing method, and even allows bots to repair items with 'Field Repair Bots'.

The new method is a plugin to the 'findNearbyCreatures mechanism' on vendor, so it might be a little buggy. Please test this code and provide feedback :D

Overview:

Once commanded to repair, the bot will scan for all nearby armourers (including repair bots). If found, it will travel to the armourer and repair specified or all items, and then return to the master. If the bot is a member of a guild, it will use guild money to repair items, else it will use it's own money. I might change this so the master can dictate whether the bot uses guild money or not.

Syntax:

/t [botname] repair [item Link][item Link].. // repairs specified items
/t [botname] repair all // command a bot to repair all items

or

/p repair all // command all party member bots to repair all items

P.S. As a bonus, bots can even sell items to 'Field Repair Bots'. Tested with Field Repair Bot 74A.

I will push a working patch to vendor shortly

Hope this helps

Link to comment
Share on other sites

is the stable branch still updated? or only the portal? have compiled today with the stable version and bots can't seem to loot quest objects. I used the survey and get commands but bots just run around. Whats the difference with the portal branch?

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