Jump to content

Recommended Posts

Posted
Hello blueboy, i propose this little patch.

Purpose : make aknoledgement to commands.

Explanation : Actualy when you type command like ".bot co player tank" there is no confirmation from bot until we send it "orders" command.

Patch : The patch just add these function and olso send us error message if we forget to target assist/protect characters.

Fixed patch

diff --git a/src/game/playerbot/PlayerbotAI.cpp b/src/game/playerbot/PlayerbotAI.cpp
index cfc2d5b..7e44967 100644
--- a/src/game/playerbot/PlayerbotAI.cpp
+++ b/src/game/playerbot/PlayerbotAI.cpp
@@ -1923,22 +1923,26 @@ void PlayerbotAI::SetCombatOrderByStr( std::string str, Unit *target ) {
}

void PlayerbotAI::SetCombatOrder( CombatOrderType co, Unit *target ) {
-    if( (co == ORDERS_ASSIST || co == ORDERS_PROTECT) && !target )
-        return;
-    if( co == ORDERS_RESET ) {
-        m_combatOrder = ORDERS_NONE;
-        m_targetAssist = 0;
-        m_targetProtect = 0;
-        return;
-    }
-    if( co == ORDERS_PROTECT )
-        m_targetProtect = target;
-    else if( co == ORDERS_ASSIST )
-        m_targetAssist = target;
-    if( (co&ORDERS_PRIMARY) )
-        m_combatOrder = (CombatOrderType)(((uint32)m_combatOrder&(uint32)ORDERS_SECONDARY)|(uint32)co);
-    else
-        m_combatOrder = (CombatOrderType)(((uint32)m_combatOrder&(uint32)ORDERS_PRIMARY)|(uint32)co);
+    if( (co == ORDERS_ASSIST || co == ORDERS_PROTECT) && !target ){
+        TellMaster("Erf, you forget to target assist/protect characters!");
+        return;
+    }
+    if( co == ORDERS_RESET ) {
+        m_combatOrder = ORDERS_NONE;
+        m_targetAssist = 0;
+        m_targetProtect = 0;
+        TellMaster("Orders are cleaned!");
+        return;
+    }
+    if( co == ORDERS_PROTECT )
+        m_targetProtect = target;
+    else if( co == ORDERS_ASSIST )
+        m_targetAssist = target;
+    if( (co&ORDERS_PRIMARY) )
+        m_combatOrder = (CombatOrderType)(((uint32)m_combatOrder&(uint32)ORDERS_SECONDARY)|(uint32)co);
+    else
+        m_combatOrder = (CombatOrderType)(((uint32)m_combatOrder&(uint32)ORDERS_PRIMARY)|(uint32)co);
+    SendOrders( *GetMaster() );
}

void PlayerbotAI::SetMovementOrder( MovementOrderType mo, Unit *followTarget ) {

Hi,

Thanks very much for the patch, it looks good. I'll try it out on my next server build, probably tomorrow now. Then if it checks out, we can push it to the repos.

EDIT: I've have posted a fixed version of your patch, that can be applied directly to the source. I'm running your patch at present, and it works very well, thanks.

Cheers

  • Replies 1.8k
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Judging by his reason given for editing the post, "I'm noobs", it would appear kingvaras felt what he had to say was dumb or pointless.

There are no dumb questions, except for the ones people ask over and over again because they refuse to learn.

Let's hope we hear more from you, kingvaras! We all start as "noobs".

Posted

Hi Guys,

I've found a logic error in the existing code for 'command orders'. The commands 'protect' and 'assist' requires a valid target, either by 'text' or by 'mouse selection'. If it is not defined by text, it is assumed to be done by selection.

.bot co leaf protect <target name> or <selection>

terminate called after throwing an instance of 'std::logic_error'
 what():  basic_string::_S_construct NULL not valid


Warning: Program '/home/mangos/wow/bin/mangos-worldd' crashed.

In PlayerbotMgr.cpp @ line 766+ in HandlePlayerbotCommand(const char* args)

If not entered by text, It is possible for a NULL value to be passed to the string pointer 'std::string' and this causes the crash.

//            std::string targetStr = targetChar;
           if(targetChar)
           {
               std::string targetStr = targetChar;
       targetGUID = sObjectMgr.GetPlayerGUIDByName( targetStr.c_str() );
           }

I have now re-arranged the code, so a check is made for a valid value ('targetChar'), before the assignment.

I will update both repos shortly

EDIT: I have now updated both repos with the fix

Hope this helps

Posted

Hi guys, sorry for being away for too long. I had alot of familiar issues there months...

Well I hope I can shortly get back to work with playerbot... I'm really sorry for that.

Regards.

Posted

Portal repo (git://github.com/blueboy/portal.git) has recently been updated with pet related code. Everybody is welcome to test it. Look into bot_readme.txt for new commands syntax. After we get enough feedback the code will be merged into blueboy repository.

Posted
Portal repo (git://github.com/blueboy/portal.git) has recently been updated with pet related code. Everybody is welcome to test it. Look into bot_readme.txt for new commands syntax. After we get enough feedback the code will be merged into blueboy repository.

Hi,

I'm testing it now

Cheers

Posted

thank for this new feature.

Anyway i didn't see any update related to mage class? I have tested it at low lvl (<5) and when combat start the mage do nothing exept if the target is near the bot use autoattack with his rod.

Am i do something wrong?

Posted

What is the locale of your game client? If it is not enGB / enUS, this is an expected behavior. Original developers of PlayerBot were going to make spell casting locale independent but abandoned the project. If there will be time I will look into this issue.

Posted

I have some thoughts on this issue. If they turn to be sane I will add a new method to AI. The downside is it will require new enum for all spells used by bots. Wowhead should help here...

Posted

Ok, the purpose is to make it applicable for another client language so if we need to add manually some new enum this would'nt be an issue. Tell me your way to avoid me work for nothing :)

Do you plan to add this translated enum for different language?

Is this the only slouttion to cast some spell? Use directly Id of the spell is not possible?

  ARCANE_MISSILES         = ai->getSpellId("arcane missiles"); //ARCANE
   ARCANE_EXPLOSION        = ai->getSpellId("arcane explosion");
   COUNTERSPELL            = ai->getSpellId("counterspell");
   SLOW                    = ai->getSpellId("slow");
   ARCANE_BARRAGE          = ai->getSpellId("arcane barrage");
   ARCANE_BLAST            = ai->getSpellId("arcane blast");
   ARCANE_POWER            = ai->getSpellId("arcane power");
...
...
   EVERY_MAN_FOR_HIMSELF   = ai->getSpellId("every man for himself"); // human
   BERSERKING              = ai->getSpellId("berserking"); // troll
   WILL_OF_THE_FORSAKEN    = ai->getSpellId("will of the forsaken"); // undead
}

Posted

Every spell has an id which is the same for all locales. Using Rank 1 ids it is possible to find id for a highest known rank of a spell. The code is short and simple, but I don't have the client by my hand to test it right now. Enum should only hide magic numbers (spell ids) by explicit spell names. Wait a little, maybe you won't have to do anything.

Posted

Spell "ice armor" called "armure de glace" in french. When i run "/cast armure de glace" the spell work but "/cast ice armor" didn't.

As you pointed there is a problem to find the highest rank of a spell for one unit because all spell have different ID...

Posted

I already pointed this problem, you must use spell.dbc from enUS or enGB client.

Or you must implement a new table with spellid and english name.

Use directly spellid is a bad thing, spells often change id.

You can look my branch : http://github.com/yad/easy-mangos

I use a custom playerbot with another system based on this one.

Posted

I will give you feedback soon.

Yad give me anyway some doubt for this method. Is the usual spell ID change realy often?

In this case we are going to have some difficult to maintain this mod.

Anyway good work kyle1 :)

Updtate :

It work perfectly ( at least the function coded ).

Just, for best practice place enum in PlayerBotMageAi.h in place of PlayerBotAi.h

Posted

Well, if you look into mangos core you will see that almost all talents, glyphs and special spells have their spell ids hardcoded. I guess core devs know what they are doing. Using database for such a task is absolutely excessive. When you rebuild your server once a week, would you care if some of spellids change after another expansion? Btw Cataclysm will get rid of spell ranks.

Posted

Ok so know i will send you soon some other enum, i will attack, war, hunter, palladin and priest right now. (just finishing mage before).

Next will come tomorrow if i have time.

cheers

Posted

No need for that, dude :) Better compile, run and report bugs. I made the enum and added mage spells and talents into it. Another classes can be added pretty easily. (Wowhead.com + OOO.Calc) * 10 mins per class, something like this.

Posted

Can anyone explain me why the config file is not working? should it be in the same folder as mangos.conf ?

coz i am trying to disable the bots but still they are there

Posted
Can anyone explain me why the config file is not working? should it be in the same folder as mangos.conf ?

coz i am trying to disable the bots but still they are there

Hi,

Yes the config file 'playerbot.conf' should be in the same folder as 'mangosd.conf'. The disable bot option at present only disables the bot(s) if summoned from the commandline (i.e .bot add <botname> ).

When I revised the 'botguy' patch, I spent a great deal of time and effort ensuring it worked without fault, with special menu display ('cost' & 'completed quest') restrictions. When I posted this patch, I received little feedback and it seemed that no one was interested in it. So I didn't spend anymore time on it. Now that I'm receiving some feedback, I will take another look at it, incorporating the other config file restrictions. I should have it finsihed shortly. In the meantime, if you want to disable the botguy menu, choose either a high cost or a very high level questid in playerbot.conf.

Hope this helps

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