Jump to content

Playerbot (archive)


Recommended Posts

Thank you for the GM patch for AHBot, blueboy. I'm honestly surprised an idea of mine turned out to be truly useful! Mostly I just throw something out there to see if it sticks, or at least gives someone food for thought that sparks a bright idea.

Also, many thanks on keeping everyone updated on what the core devs are up to and how it affects the denizens of the Core Mods forum. You're an indispensable part of this community and I'm very thankful you're here. Keep up the good fight! :)

Link to comment
Share on other sites

  • Replies 1.8k
  • Created
  • Last Reply

Top Posters In This Topic

Hi Guys,

RE: In response to a question about priest bots causing a server crash, whilst casting HEAL on group members, out of sight

Thanks to mrelfire, I have taken a closer look at the code. I have found several logic errors in PlayerbotPriestAI.cpp, related to the following spells (Auras)

prayer of fortitude

power word: fortitude

prayer of spirit

divine spirit

In the function uint32 PlayerbotAI::getSpellId(const char* args, bool master) const You will note that the value returned is of type uint32 and not bool. However, it is used frequently in boolean expressions thus;

If SpellId is not found, then the returned value = zero (or false)

If found, it will return a positive non-zero Spellid (or true)

I found the following

PWS = ai->getSpellId("power word: shield");

if((FORTITUDE = ai->getSpellId ("prayer of fortitude"))==1)

FORTITUDE = ai->getSpellId("prayer of fortitude");

if((FORTITUDE = ai->getSpellId ("power word: fortitude"))==1 && (FORTITUDE = ai->getSpellId ("prayer of fortitude"))==0)

FORTITUDE = ai->getSpellId("power word: fortitude");

FEAR_WARD = ai->getSpellId("fear ward");

if((DSPIRIT = ai->getSpellId ("prayer of spirit"))==1)

DSPIRIT = ai->getSpellId("prayer of spirit");

if((DSPIRIT = ai->getSpellId ("divine spirit"))==1 && (DSPIRIT = ai->getSpellId ("prayer of spirit"))==0)

DSPIRIT = ai->getSpellId("divine spirit");

MASS_DISPEL = ai->getSpellId("mass dispel");

Incorrectly the following test is used, return value == 1 (never true) and this should be, return value > 0

I must admit, it is rare that I run with a group larger than about 5. Who knows how raid groups will behave with the Playerbot AI and what effect they would have on the servers performance (recent freeze issue). I have briefly looked at the code and distance restrictions on casting spells seem only to be placed on aggressive spells. I can't imagine that the absence of a group member would have such a catastrophic effect on the server.

RE: In response to an ongoing issue, linked to HasAura, that causes mrelfire 's server to repeatedly crash

I have also added a condition to HasAura to handle the possible situation where a spellId might be zero or less.

bool PlayerbotAI::HasAura(uint32 spellId, const Unit& player) const
{
   if(spellId <= 0)
       return false;

   for (Unit::AuraMap::const_iterator iter = player.GetAuras().begin(); iter != player.GetAuras().end(); ++iter)
   {
       if (iter->second->GetId() == spellId)
           return true;
   }
   return false;
}

this may help, we'll have to try it. I will update the code on blueboy shortly.

Hope this helps

Link to comment
Share on other sites

Hi Guys,

RE: In response to a question about priest bots causing a server crash, whilst casting HEAL on group members, out of sight

Thanks to mrelfire, I have taken a closer look at the code. I have found several logic errors in PlayerbotPriestAI.cpp, related to the following spells (Auras)

prayer of fortitude

power word: fortitude

prayer of spirit

divine spirit

In the function uint32 PlayerbotAI::getSpellId(const char* args, bool master) const You will note that the value returned is of type uint32 and not bool. However, it is used frequently in boolean expressions thus;

If SpellId is not found, then the returned value = zero (or false)

If found, it will return a positive non-zero Spellid (or true)

I found the following

Incorrectly the following test is used, return value == 1 (never true) and this should be, return value > 0

I must admit, it is rare that I run with a group larger than about 5. Who knows how raid groups will behave with the Playerbot AI and what effect they would have on the servers performance (recent freeze issue). I have briefly looked at the code and distance restrictions on casting spells seem only to be placed on aggressive spells. I can't imagine that the absence of a group member would have such a catastrophic effect on the server.

RE: In response to an ongoing issue, linked to HasAura, that causes mrelfire 's server to repeatedly crash

I have also added a condition to HasAura to handle the possible situation where a spellId might be zero or less.

bool PlayerbotAI::HasAura(uint32 spellId, const Unit& player) const
{
   if(spellId <= 0)
       return false;

   for (Unit::AuraMap::const_iterator iter = player.GetAuras().begin(); iter != player.GetAuras().end(); ++iter)
   {
       if (iter->second->GetId() == spellId)
           return true;
   }
   return false;
}

this may help, we'll have to try it. I will update the code on blueboy shortly.

Hope this helps

No Crash !!!, very good news, but the priest try to launch its skill on people not near him, and use all its mana for nothing

Link to comment
Share on other sites

No Crash !!!, very good news, but the priest try to launch its skill on people not near him, and use all its mana for nothing

Hi,

No crash, is good news. Let's hope it stays that way. As far as the priest is concerned, mana is not expended for nothing. The priest is just doing its job. 'Power Word: Fortitude' AURA is cast on all members of the group every 16 minutes, as it runs out. If the group is very large, then I am not surprised the mana runs out too. As I said in my last post, there are no distance restrictions on non aggressive spells. For small groups, distance is not an issue. However, I appreciate with your raid group scenario it would. I shall see if I can add a distance check, which will exclude remote group members.

Cheers

Link to comment
Share on other sites

A quick reply of different test

Priest:

In general no problems as I said good news, but a crash occured when you leave a dungeon in raid mode, and the bot priest is dead vs master (for testing everybody died, you do a tele group to stormwind => crash) looking at the log it seems he tryes to cast an aura skill with him died or you died (hope it is clear)

Warlock:

Doesn't work a lot => never see him casting his pets (is it bad luck ?)

Magician:

a 80 level with full mana still attacking instead of one step back and cast a spell make a lot of fun :)

and last "repairing" is "needed" :) => dying too much unfortunately broke your stuff :)

Link to comment
Share on other sites

More testing:

in Raid mod:

a human chief of the raid with 2 bots

second human with X bots

If you enter a dungeon :

- only the first human, with its bots + the second human can enter the dungeon.

- None of the X bots entered the dungeon (the chief of the raid has to teleport all of these bots manually)

- this is the same rule for other humans with other Y bots

Link to comment
Share on other sites

Hi Guys,

In response to a popular request, I have created the Repair patch, for you to test.

The patch allows you to repair only group member bots, as the player repairs. To exclude bot(s) from repair, temporarily uninvite bot(s) from group.

# Normal repair, paid for by individual bot

# Guild repair, paid by the guild bank

Limitations.

As the repair 'anvil' has to be active on the client, to allow selection. If the player does not require repair or has no money, you can not repair bot(s).

It is not practical to allow bot(s) to repair individual items, as the player can. But you can't have everything :rolleyes:

The patch is designed to work with small groups, where the bot(s) are close enough to the player & NPC, to interact.

Revised Repair patch

diff --git a/src/game/PlayerbotMgr.cpp b/src/game/PlayerbotMgr.cpp
index c66b483..3feae0d 100644
--- a/src/game/PlayerbotMgr.cpp
+++ b/src/game/PlayerbotMgr.cpp
@@ -9,6 +9,7 @@
#include "GossipDef.h"
#include "Chat.h"
#include "Language.h"
+#include "Guild.h"

class LoginQueryHolder;
class CharacterHandler;
@@ -323,8 +324,73 @@ void PlayerbotMgr::HandleMasterIncomingPacket(const WorldPacket& packet)
               }
               return;
        }
+        case CMSG_REPAIR_ITEM:
+        {

+               WorldPacket p(packet); // WorldPacket packet for CMSG_REPAIR_ITEM, (8+8+1)

+               sLog.outDebug("PlayerbotMgr: CMSG_REPAIR_ITEM");
+
+               uint64 npcGUID, itemGUID;
+               uint8 guildBank;
+
+               p.rpos(0); //reset packet pointer
+               p >> npcGUID;
+               p >> itemGUID;  // Not used for bot but necessary opcode data retrieval
+               p >> guildBank; // Flagged if guild repair selected
+
+               for (PlayerBotMap::const_iterator it = GetPlayerBotsBegin(); it != GetPlayerBotsEnd(); ++it)
+               {
+
+                    Player* const bot = it->second;
+                    if(!bot)
+                         return;
+
+                    Group* group = bot->GetGroup();  // check if bot is a member of group
+                    if(!group)
+                         return;
+
+                    Creature *unit = bot->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR);
+                    if (!unit) // Check if NPC can repair bot or not
+                    {
+                         sLog.outDebug("PlayerbotMgr: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)));
+                         return;
+                    }
+
+                    // remove fake death
+                    if(bot->hasUnitState(UNIT_STAT_DIED))
+                         bot->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+
+                    // reputation discount
+                    float discountMod = bot->GetReputationPriceDiscount(unit);
+
+                    uint32 TotalCost = 0;
+                    if (itemGUID) // Handle redundant feature (repair individual item) for bot
+                    {
+                         sLog.outDebug("ITEM: Repair single item is not applicable for %s",bot->GetName());
+                         continue;
+                    }
+                    else  // Handle feature (repair all items) for bot
+                    {
+                         sLog.outDebug("ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID));
+
+                         TotalCost = bot->DurabilityRepairAll(true,discountMod,guildBank>0?true:false);
+                    }
+                    if (guildBank) // Handle guild repair
+                    {
+                         uint32 GuildId = bot->GetGuildId();
+                         if (!GuildId)
+                              return;
+                         Guild *pGuild = sObjectMgr.GetGuildById(GuildId);
+                         if (!pGuild)
+                              return;
+                         pGuild->LogBankEvent(GUILD_BANK_LOG_REPAIR_MONEY, 0, bot->GetGUIDLow(), TotalCost);
+                         pGuild->SendMoneyInfo(bot->GetSession(), bot->GetGUIDLow());
+                    }
+
+               }
+               return;
+        }
        /*
        case CMSG_NAME_QUERY:
        case MSG_MOVE_START_FORWARD:

EDIT: Sorry I left a reference to the Guild header file out of the patch. I have revised the above patch.

Hope you like it, and once again please give constructive feedback

Link to comment
Share on other sites

Hello blue boy i dont know if here is the best place to ask this but i want to know how i get a core to compile with playerbot at a revision that i need i mean i have the silvermoon db that need 9622 and i go to ur git and enter in that revision 9622 put download source and download the thing for compile in 9622 but without the playerbot inside i want to know that because i cant find a explanation about that .greetings valgrintor

Link to comment
Share on other sites

Hello blue boy i dont know if here is the best place to ask this but i want to know how i get a core to compile with playerbot at a revision that i need i mean i have the silvermoon db that need 9622 and i go to ur git and enter in that revision 9622 put download source and download the thing for compile in 9622 but without the playerbot inside i want to know that because i cant find a explanation about that .greetings valgrintor

Hi,

The easiest solution would be for you to send me a private message, and I will do my best to help you

Cheers

Link to comment
Share on other sites

is there a way to add more than 9 playerbots? i mean, adding characters from other (maybe locked/banned or sth) accounts would be nice!

just imagine doing Temple of AhnQiraj with 39 Bots

I think there would be a lot of problems with this. The current limit of 9 is because of a client-side limitation of only being allowed 10 toons per realm. I don't think pulling bots from other accounts would go over well at all. Imagine having someone summon your bot and then using trade to strip it of all its items. Or even just logging into a particular toon only to find it had previously been summoned by another player to a completely different part of the world.

skinlayers

Link to comment
Share on other sites

i did everything blueboy told me but it wont patch it..

First make a script for GIT bash

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

did this one too after patch was made

> git clone git://github.com/mangos/mangos.git
> cd mangos

tryed both but none of them will patch. got everything installed ok

once done do

> git checkout -b 9668 0520c6c8733b6b50e9126505c2072c60f909d70b
> git apply --whitespace=fix playerbot.patch

it just comes up with loads of errors and and wont patch. any help

Link to comment
Share on other sites

Hey, does Blueboy or any other patch authors still read this thread? I was just wondering about working towards extending this to specific creature/boss encounters and battlegrounds, and perhaps doing it inside of a seperate DLL and starting a seperate project for this.

Link to comment
Share on other sites

i did everything blueboy told me but it wont patch it..

First make a script for GIT bash

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

did this one too after patch was made

> git clone git://github.com/mangos/mangos.git
> cd mangos

tryed both but none of them will patch. got everything installed ok

once done do

> git checkout -b 9668 0520c6c8733b6b50e9126505c2072c60f909d70b
> git apply --whitespace=fix playerbot.patch

it just comes up with loads of errors and and wont patch. any help

Hi,

If you give us some details on the errors we might be able to help. 'loads of errors' tells us nothing and these errors are not happening to most users of playerbot.

Cheers

Link to comment
Share on other sites

Hey, does Blueboy or any other patch authors still read this thread? I was just wondering about working towards extending this to specific creature/boss encounters and battlegrounds, and perhaps doing it inside of a seperate DLL and starting a seperate project for this.

Hi,

Yes I try to read this thread, unlike most. Are you offering to help, there is a limit to what one person can do.

Cheers

Link to comment
Share on other sites

Hi,

If you give us some details on the errors we might be able to help. 'loads of errors' tells us nothing and these errors are not happening to most users of playerbot.

Cheers

http://img229.imageshack.us/img229/3047/95849533.jpg

thats the errors ^^

Link to comment
Share on other sites

http://img229.imageshack.us/img229/3047/95849533.jpg

thats the errors ^^

Hi,

Not very easy to read, but I would say that you have created a bad patch. Your script is wrong.

git fetch git://github.com/mangos/mangos.git master:mangos

HASH=`git log --pretty=oneline | grep -m 1 '\\[9[0-9]\\{3\\}]' | cut -d " " -f 1`

git checkout mangos

mangos should be playerbot.

The playerbot patch would have no reason to update the MaNGOS sql files, as the errors suggest. I see from your last post that you copied the example I gave you,

> git checkout -b 9668 0520c6c8733b6b50e9126505c2072c60f909d70b

> git apply --whitespace=fix playerbot.patch

Why not start by using the version of MaNGOS that the code on blueboy is currently integrated with. i.e MaNGOS[9644]. I will now give you step-by-step instructions.

First, create the patch using this script, courtesy of skinlayers

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

then

> git clone git://github.com/mangos/mangos.git
> cd mangos

git log to get the HASH code 91d5f2300cb0780830ac5634ac29b1c7ea16a96a for MaNGOS[9644]

> git checkout -b 9644 91d5f2300cb0780830ac5634ac29b1c7ea16a96a
Switched to a new branch '9644'

Finally apply the patch. It is a good idea to use the '--check' option, should there be any errors :rolleyes:

> git apply --check --whitespace=fix playerbot.patch

or if you have the Gnu patch utility. This uses --dry-run equivalent to --check for git.

> patch --dry-run -p1 < playerbot.patch

Note: Remove --check or --dry-run , to actually apply patch

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