Jump to content

Playerbot (archive)


Recommended Posts

Symptom:

Bots would not teleport to the master. When forced with the 'follow' command, the client would say '[bot] is already being teleported, could not teleport'. Meanwhile the server would be going ballistic with MSG_MOVE_TELEPORT_ACK, over and over again.

Solution:

I have been using a patch to reverse a change made by vladimirmangos in [8601] (Fixed some movement *_ACK packets structure after switch). The fix appears to alter the way 'guid' is read from the world packet. Before; this value was transferred from the packet pointer (recv_data) thus

recv_data >> guid;

After [8601] this disappeared, and was replaced by

if(!recv_data.readPackGUID(guid)) return;

Interestly in most functions 'guid' is not used, but in HandleMoveTeleportAck(WorldPacket& recv_data) it is. Further more, no mention of a change to this function is recorded in the commit.

I placed flags in this function to monitor values of 'guid' and identify what was happening. Inside the function there is a conditional statement,

if(guid != plMover->GetGUID()) return;

If the 'guid' does not match the guid of the bot being teleported, then it will exit the function. In the changed function 'guid' value is always zero so the condition is always met. The result is that the teleport is never completed. I reversed the change and hey presto!, all of my bots arrived at the master location.

I have been using this patch since [8601] and have yet to see a reversal to the code in either the ManGOS core, or the playerbot branch. I have posted here because this isssue may only effect playerbot systems. If this is useful, maybe someone will intergrate the patch as a commit to the playerbot code.

Change to HandleMoveTeleportAck in MovementHandler.cpp;

diff -crB a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp

*** a/src/game/MovementHandler.cpp 2009-10-12 21:40:50.000000000 +0100

--- b/src/game/MovementHandler.cpp 2009-10-12 21:50:13.000000000 +0100

***************

*** 173,183 ****

{

sLog.outDebug("MSG_MOVE_TELEPORT_ACK");

uint64 guid;

-

- if(!recv_data.readPackGUID(guid))

- return;

-

uint32 flags, time;

recv_data >> flags >> time;

DEBUG_LOG("Guid " UI64FMTD, guid);

DEBUG_LOG("Flags %u, time %u", flags, time/IN_MILISECONDS);

--- 173,181 ----

{

sLog.outDebug("MSG_MOVE_TELEPORT_ACK");

uint64 guid;

uint32 flags, time;

+

+ recv_data >> guid;

recv_data >> flags >> time;

DEBUG_LOG("Guid " UI64FMTD, guid);

DEBUG_LOG("Flags %u, time %u", flags, time/IN_MILISECONDS);

Execute patch in source root directory as follows, patch -p1 < my.patch

Link to comment
Share on other sites

  • Replies 1.8k
  • Created
  • Last Reply

Top Posters In This Topic

Overview

Is anyone tired of using 'Master Looter' as the default loot method. I create bot guilds and it is a real pain to dish out the booty to my bot groups, slowing the adventuring right down.

I have created a patch to randomly decide NEED or GREED for each of the bots. The rolls are returned almost immediately, for each item being rolled for!

Advantages

No need to change the looting method each time you log on, and never loose a unique item because you forgot to make the change. If you loose the roll, get it back by trading with the bots. They are most accommodating....

How it works

The patch intercepts the CMSG_LOOT_ROLL from the client. When a NEED or GREED dialog box pops up, you make your choice, and this is captured at the server. There is a random choice made for each bot and each item being rolled for. This is then passed to the CountRollVote function. That's it!

Many thanks to rrtn for his work in commiting my last patch: Pet feeding for hunters. Here is the patch,

diff -crB a/src/game/PlayerbotMgr.cpp b/src/game/PlayerbotMgr.cpp

*** a/src/game/PlayerbotMgr.cpp 2009-11-16 22:11:49.000000000 +0000

--- b/src/game/PlayerbotMgr.cpp 2009-11-16 22:16:02.000000000 +0000

***************

*** 280,286 ****

}

return;

}

! /*

case CMSG_NAME_QUERY:

case MSG_MOVE_START_FORWARD:

case MSG_MOVE_STOP:

--- 280,347 ----

}

return;

}

!

! case CMSG_LOOT_ROLL:

! {

!

! WorldPacket p(packet); //WorldPacket packet for CMSG_LOOT_ROLL, (8+4+1)

! uint64 Guid;

! uint32 NumberOfPlayers;

! uint8 rollType;

! p.rpos(0); //reset packet pointer

! p >> Guid; //guid of the item rolled

! p >> NumberOfPlayers; //number of players invited to roll

! p >> rollType; //need,greed or pass on roll

!

!

! for (PlayerBotMap::const_iterator it = GetPlayerBotsBegin(); it != GetPlayerBotsEnd(); ++it)

! {

!

! uint32 choice = urand(0,2); //returns 0,1,or 2

!

! Player* const bot = it->second;

! if(!bot)

! return;

!

! Group* group = bot->GetGroup();

! if(!group)

! return;

!

! switch (group->GetLootMethod())

! {

! case GROUP_LOOT:

! // bot random roll

! group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);

! break;

! case NEED_BEFORE_GREED:

! choice = 1;

! // bot need roll

! group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);

! break;

! case MASTER_LOOT:

! choice = 0;

! // bot pass on roll

! group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);

! break;

! default:

! break;

! }

!

! switch (rollType)

! {

! case ROLL_NEED:

! bot->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);

! break;

! case ROLL_GREED:

! bot->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1);

! break;

! }

!

! }

! return;

! }

!

! /*

case CMSG_NAME_QUERY:

case MSG_MOVE_START_FORWARD:

case MSG_MOVE_STOP:

execute above patch in source root, patch -p1 < my.patch

Link to comment
Share on other sites

thank you very much for your contribution to this project blueboy, your need or greed loot patch sounds very interesting and yes feel free to post as much as you want :) also i will take this time to say; this is an open invitation to ALL who want to help playerbot! many playerbot members seem to be AFK at the moment so if you have anything to contribute(a fix or update) plz post here!

thanks, rrtn

Link to comment
Share on other sites

on tc i have in group.cpp

Player *playerToRoll = itr->getSource();

if(!playerToRoll || !playerToRoll->GetSession() || player->isPlayerbot())

continue;

don't know if it works in mangos.

this way bot rolls aren't counted

works perfectly in 99% of all cases... sometimes there is beeing sent automatically pass from my client, dunno why...

Link to comment
Share on other sites

Interesting!:)

Correct me if I'm wrong, your method bypasses the bots on a NEED or GREED roll altogether. I thought it would be nice if the bots appeared to interact with the roll process. As far as I know the patch works 100% I have included NEED before GREED, and MASTER loot options, although this maybe redundant code. Master loot option does not require a roll? My patch is a prototype, and I'm sure it could be improved.

Thanks for your contribution, I'll try it out on my server.

Link to comment
Share on other sites

Hello, I use french DBC and spells (based on name search) don't work

So I implemente a new table with 2 colomns : entry and english spell name, and it works.

http://filebeam.com/06764ef221cb5a6a3838c67d26c99535

You can delete this code, I miss it in patch :

   int loc = 0;
   if (master)
       loc = GetMaster()->GetSession()->GetSessionDbcLocale();
   else
       loc = m_bot->GetSession()->GetSessionDbcLocale();

I use a php code to generate SQL data based on english dbc.

Link to comment
Share on other sites

Interesting!:)

Correct me if I'm wrong, your method bypasses the bots on a NEED or GREED roll altogether. I thought it would be nice if the bots appeared to interact with the roll process. As far as I know the patch works 100% I have included NEED before GREED, and MASTER loot options, although this maybe redundant code. Master loot option does not require a roll? My patch is a prototype, and I'm sure it could be improved.

Thanks for your contribution, I'll try it out on my server.

you can use this in grouploot fct. too.

i don't like the idea, the bost randomly roll on items. i'd like either them passing on all or (in case of master loot, where is no need for rolling) assinging the items to the bots.

@yad: MY wrath installation installed english (coudn't deselect) AND locale (optional/deselectable) data (dbc) so i had no need for translating the spellnames in the AI files into my native language.

i had this problem with 2.4.3 client, where i had only german locales. but there i just translated them using w0whead. had some problems with special characters, but they are past =)

Link to comment
Share on other sites

I believe it is important to strive to improve the AI realism of playerbot. roflnap's suggestion got me thinking about my submission. If the bots were outside the interaction distance to loot a corpse, would they be included in the roll or not? Often bots are waylaid by combat, during player flight. I as a player would not expect to gain, if a roll was required on a npc corpse in this situation. I was concerned because in my patch all group members are considered. Should I include a conditional statement, to exclude absent bots?

Test

I tested this by first assembling a group. I then instructed one bot to '/w [bot] stay'. The remainder of the group then went off plundering. Eventually a corpse required a need or greed roll. Interestly the client intelligently identifies the reduced number in the group, and excludes the bot left behind from the roll. No addition code is required to handle this.

I have revised my patch to handle all loot methods, requiring a roll. As 'default:' in the GetLootMethod() switch statement.

In addition, I had ommited to change the value supplied to the GetAchievementMgr() switch statement. There are two achievement milestones in the game, 'NEEDY' and 'GREEDY'. If these are not updated correctly then individual bots will not get the credit they are due. The value in the 'rollType' variable represents the chioce made by the player and not the bot. I have changed this to the bot's choice.

Revision to previous patch

diff -crB a/src/game/PlayerbotMgr.cpp b/src/game/PlayerbotMgr.cpp

*** a/src/game/PlayerbotMgr.cpp 2009-11-18 16:23:32.000000000 +0000

--- b/src/game/PlayerbotMgr.cpp 2009-11-18 16:26:01.000000000 +0000

***************

*** 308,332 ****

switch (group->GetLootMethod())

{

! case GROUP_LOOT:

! // bot random roll

! group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);

! break;

! case NEED_BEFORE_GREED:

! choice = 1;

! // bot need roll

! group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);

! break;

! case MASTER_LOOT:

! choice = 0;

! // bot pass on roll

! group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);

! break;

default:

break;

}

! switch (rollType)

{

case ROLL_NEED:

bot->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);

--- 308,322 ----

switch (group->GetLootMethod())

{

! //case GROUP_LOOT:

! //case NEED_BEFORE_GREED:

! //case MASTER_LOOT:

default:

+ group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);

break;

}

! switch (choice)

{

case ROLL_NEED:

bot->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);

P.S;)

In response to roflnap's messege. I am sorry if you don't like my approach to group loot. You can either delete my addition or set 'choice' variable to zero, so the bots pass on everything. As I pointed out in my original message, if you loose out on a roll, you can always get the item back later by trading with the bots. Another advantage to my method is that the bots act as additional baggage.

Link to comment
Share on other sites

Hello, I use french DBC and spells (based on name search) don't work

So I implemente a new table with 2 colomns : entry and english spell name, and it works.

http://filebeam.com/06764ef221cb5a6a3838c67d26c99535

You can delete this code, I miss it in patch :

   int loc = 0;
   if (master)
       loc = GetMaster()->GetSession()->GetSessionDbcLocale();
   else
       loc = m_bot->GetSession()->GetSessionDbcLocale();

I use a php code to generate SQL data based on english dbc.

I think it is too custom, why don't use what is already in the Mangos system instead of creating a new table for duplicate work?

I believe you don't understand what are these 5 simple lines do. By the way, in order to have spell locale working, you have to install both enUS and frFR DBC file.

Link to comment
Share on other sites

In fact if I want to use current patch in github, I must switch my spell.dbc (in dbc folder) by a spell.dbc enUS

In spell.dbc (frFR)

I haven't english spell name in dbc frFR, so when you search spellid based on spell name 99% of time, function returns 0.

For me it's the best issue. However I maybe not understand spellid function search. But it doesn't work and now it works !

(I'm agree it's too custom)

Link to comment
Share on other sites

P.S;)

In response to roflnap's messege. I am sorry if you don't like my approach to group loot. You can either delete my addition or set 'choice' variable to zero, so the bots pass on everything. As I pointed out in my original message, if you loose out on a roll, you can always get the item back later by trading with the bots. Another advantage to my method is that the bots act as additional baggage.

hey, i didn't say, i don't like your way. i like your way more as mine! but my is more simple =)

i said only, i don't like bots RANDOMLY rolling on items.

also, the "near players"-check is made in group.cpp in the particular functions (grouploot and needbeforegreed)

and trading soulbound items isn't possible :(

@ yad's problem: i'm glad to have GERMAN dbc's and english installed by default!

i don't know, weather he gets no french dbc from eu wrath installation!

/t botsname cast Lumière sacrée (example for a paladin)

/t botsname cast Holy Light

if i'm right, i can use both (english and german, noz french ;)) on wrath!

attention to the special characters in the string (è, é)

i had problems returning spellid 0 when having a spell with special characters like "Segen der Könige" (or Lumière sacrée)

Link to comment
Share on other sites

hey, i didn't say, i don't like your way. i like your way more as mine! but my is more simple =)

i said only, i don't like bots RANDOMLY rolling on items.

also, the "near players"-check is made in group.cpp in the particular functions (grouploot and needbeforegreed)

and trading soulbound items isn't possible :(

Hi Roflnap,

Sorry for any misunderstanding on my part. In truth, if I had seen your solution first, I would never had written mine ;)

I didn't think 'bind on pickup' items were offered on need or greed rolls?

I am sure your aware that the random feature of my patch can be changed. Can you set 'Master looter' as the default loot method at the client?

I have just found something which may help you use 'Master Looter' as the default loot method,

In GroupHandler.cpp there is a function HandleLootMethodOpcode( WorldPacket & recv_data ) this checks for group membership and set the loot method with info from the client. Rather than accept the client choice, you could force your own 'lootMethod' at the server. Hope this helps!

My next project will be to try and improve the bot interaction with certain quests. It's a real pain to login in and out, for every bot, each time a quest item requires 'selection' to recover, (i.e opening a chest to get the item). I know some quests provide copies of an item to each looters. If you got any ideas, I would be grateful:)

Link to comment
Share on other sites

There seems to be a major bug in the playerbots. the bots themselves work great. however, it messes up the realm.

if you teleport (either thru gm commands, or portals) nothing spawns. no GO's nor NPC's. you must relog (not exit. just log out and back in) to get the spawns back.

running MaNGOS rev. 8836 with playerbots.

I guess I have really bad luck with playerbots. been trying them for over a year, and every time I compile them in, there is a major glitch of some sort, forcing me to recompile without them.

Just thought I would report this, and see if anyone else has had similar problems.

I also run TeleNPC2 (db driven teleport guy) speedpatch, and a few minor patches I wrote for myself, to remove the item warnings in the logs\\console and removing the level 100 limit. I also run autoannounce, but I know it isnt that one causing a conflict, cuz it did it before I installed tht one. without playerbots spawns work fine.

Link to comment
Share on other sites

There seems to be a major bug in the playerbots. the bots themselves work great. however, it messes up the realm.

if you teleport (either thru gm commands, or portals) nothing spawns. no GO's nor NPC's. you must relog (not exit. just log out and back in) to get the spawns back.

running MaNGOS rev. 8836 with playerbots.

I guess I have really bad luck with playerbots. been trying them for over a year, and every time I compile them in, there is a major glitch of some sort, forcing me to recompile without them.

Just thought I would report this, and see if anyone else has had similar problems.

I also run TeleNPC2 (db driven teleport guy) speedpatch, and a few minor patches I wrote for myself, to remove the item warnings in the logs\\console and removing the level 100 limit. I also run autoannounce, but I know it isnt that one causing a conflict, cuz it did it before I installed tht one. without playerbots spawns work fine.

I've had this issue for sometime. Using the gm command '.start' or using of hearthstone. I was wondering whether the bots teleporting to the master player, maybe the cause. Hovever, it also happens if no bots are present. I agree that this is a issue that should be addressed.

MaNGOS: 8803

SD2:1498

PSMDB 266

Latest playerbot from github

Latest auctionhousebot from github

& autobroadcast

I can reproduce the glitch, with debug info at the server.

I got two of my characters to teleport (.start) to their homes. One long distance teleport and the other short.

1. Draenei Shaman, Goldshire to Azuremyst Isle was good with no glitch.

Spell: Effect : 84

Spell Effect: Stuck

Player Hans (guid 46) used auto-unstuck future at map 0 (-9381.839844, -103.833000, 60.792599)

Player Hans is being teleported to map 530

Player Hans is being teleported to map 530

WORLD: got MSG_MOVE_WORLDPORT_ACK.

CHARACTER: Sent Initial Spells

Initializing Action Buttons for '46'

Action Buttons for '46' Initialized

Loading map /home/mangos/wow/maps/5303958.map

VMAP loaded name:Outland, id:530, x:39, y:58 (vmap rep.: x:39, y:58)

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

2. Human Warlock, Westfall to Northshire with glitch, nothing spawning.

Spell: Effect : 84

Spell Effect: Stuck

Player Lane (guid 52) used auto-unstuck future at map 0 (-10531.400391, 1073.530029, 51.768650)

Player Lane is being teleported to map 0

Player Lane is being teleported to map 0

MSG_MOVE_TELEPORT_ACK

ERROR: Attempted to get in ByteBuffer (pos: 8 size: 10) value with size: 4

WorldSession::Update ByteBufferException occured while parsing a packet (opcode: 199) from client 192.168.2.100, accountid=13. Skipped packet.

Dumping error causing packet:

STORAGE_SIZE: 10

01 34 00 00 00 00 B9 E6 | 71 02

WORLD: Recvd MSG_MOVE_FALL_LAND (201, 0xC9) opcode

Looks like a problem with the world packet while parsing opcode (199), (transfering data from packet to associated variables).

Opcodes.cpp: /*0x0C7*/ { "MSG_MOVE_TELEPORT_ACK", STATUS_LOGGEDIN, &WorldSession::HandleMoveTeleportAck },

Opcodes.h: MSG_MOVE_TELEPORT_ACK = 0x0C7, (199)

I hate to say this, but I might have been partly responsible for this issue, with my recent fix.

Using

recv_data >> guid;

allows bots to be summoned to master location (No MSG_MOVE_TELEPORT_ACK loop at server). However, player Near teleport(2) glitch occurs, requiring a logout & login.

Player Far teleport(1) doesn't appear to be effected.

or

if(!recv_data.readPackGUID(guid))

return;

allows players to teleport without glitch, but bots get lost in transist and server gets caught in a MSG_MOVE_TELEPORT_ACK loop. vladimirmangos made this change to the MaNGOS code [8601], to resolve player teleport issues. No consideration was made for playerbot. Until this issue is resolved, you can either use my fix or do without bots. Hopefully, now I have identified the issue, someone can come up with a long term solution.

Link to comment
Share on other sites

if i'm right, i can use both (english and german, noz french ;)) on wrath!

attention to the special characters in the string (è, é)

i had problems returning spellid 0 when having a spell with special characters like "Segen der Könige" (or Lumière sacrée)

Ha, you got the point

I guess it is because that command argument (PlayerbotAI::HandleCommand) is not wrapped into UTF8 so it can't read those characters

I am not sure if it will work, but try to Utf8FitTo() for text (the argument parameter) in PlayerbotAI::HandleCommand (or other way to read as UTF8)

Link to comment
Share on other sites

Ha, you got the point

I guess it is because that command argument (PlayerbotAI::HandleCommand) is not wrapped into UTF8 so it can't read those characters

I am not sure if it will work, but try to Utf8FitTo() for text (the argument parameter) in PlayerbotAI::HandleCommand (or other way to read as UTF8)

i tried several ways to achieve proper "utf8" conversion (utf8towstring for example, literals and so on), but without success...

then i changed the special characters of the spell in the source.

i had to enter eg. for an 'ö' a 'ö'. (Segen der Könige, Blessing of Kings in german)

(ä to ä, ü to ü, ö to ö and ß to ß)

AFTER entering these special characters AND compiling, these special characters were dispayed as normal ä,ö,ü or ß.

i'm using vc++2008xpress win32

@blueboy: is runsttren working on gameobject interactivity of the bots, isn't he?

Link to comment
Share on other sites

This sounds really kickass, haven't had a chance to grab from the Repository yet, but I will when I get a chance. I think I'll throw together a quick and easy Interface Command Addon for it too, so that you can command the bot using a simple WoW UI Addon. Once done I'll PM it to you guys so you can add it to your repository.

Good Luck with this project! (stuff like this is exactly why I left the "Flightless Bird" for the "Forbidden Fruit").

I'm also working on a GMH conversion for MaNGOS (I know it's been done, but I hope to keep updating mine and add stability to it), so I may just merge this into my GMH.

Link to comment
Share on other sites

There seems to be a major bug in the playerbots. the bots themselves work great. however, it messes up the realm.

if you teleport (either thru gm commands, or portals) nothing spawns. no GO's nor NPC's. you must relog (not exit. just log out and back in) to get the spawns back.

running MaNGOS rev. 8836 with playerbots.

I guess I have really bad luck with playerbots. been trying them for over a year, and every time I compile them in, there is a major glitch of some sort, forcing me to recompile without them.

Just thought I would report this, and see if anyone else has had similar problems.

I also run TeleNPC2 (db driven teleport guy) speedpatch, and a few minor patches I wrote for myself, to remove the item warnings in the logs\\console and removing the level 100 limit. I also run autoannounce, but I know it isnt that one causing a conflict, cuz it did it before I installed tht one. without playerbots spawns work fine.

I have a much better solution for the MSG_MOVE_TELEPORT_ACK issue, and one that does not cause the spawning issue on teleportation. I had narrowed the cause down to the data in the 'guid' variable, from HandleMoveTeleportAck(WorldPacket& recv_data) in MovementHandler.cpp. The player's data originates from the client, but the bots data is pass from PlayerbotAI::HandleTeleportAck(). I tried to use extractGUID from PlayrebotAI.cpp, and several other approaches without any success. In the end I looked for the definition of readPackGUID(guid), in the hope I could understand how the data was formatted. While examining this in ByteBuffer.h, I came across the associated sister function appendPackGUID(guid). This allows you to write 'guid' data to the world packet, Bingo! If vladimirmangos has used readPackGUID to resolve player teleportation issues, it make sense that appendPackGUID would work for Playerbot.

What this means is that my recent fix needs to be reversed, and a small, but vital change made to PlayerbotAI.cpp. I have included the patch below so you can try, before you buy! I would hate this revision to be integrated into the github code, before it is fully tested by everyone. Hopefully this will be a long term solution.

Teleportation patch:

diff -crB a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp

*** a/src/game/MovementHandler.cpp 2009-11-21 05:10:29.000000000 +0000

--- b/src/game/MovementHandler.cpp 2009-11-21 05:15:51.000000000 +0000

***************

*** 175,181 ****

uint64 guid;

uint32 flags, time;

! recv_data >> guid;

recv_data >> flags >> time;

DEBUG_LOG("Guid " UI64FMTD, guid);

DEBUG_LOG("Flags %u, time %u", flags, time/IN_MILISECONDS);

--- 175,183 ----

uint64 guid;

uint32 flags, time;

! if(!recv_data.readPackGUID(guid))

! return;

!

recv_data >> flags >> time;

DEBUG_LOG("Guid " UI64FMTD, guid);

DEBUG_LOG("Flags %u, time %u", flags, time/IN_MILISECONDS);

diff -crB a/src/game/PlayerbotAI.cpp b/src/game/PlayerbotAI.cpp

*** a/src/game/PlayerbotAI.cpp 2009-11-21 05:11:15.000000000 +0000

--- b/src/game/PlayerbotAI.cpp 2009-11-21 05:13:21.000000000 +0000

***************

*** 2401,2407 ****

if (m_bot->IsBeingTeleportedNear())

{

WorldPacket p = WorldPacket(MSG_MOVE_TELEPORT_ACK, 8 + 4 + 4);

! p << m_bot->GetGUID();

p << (uint32) 0; // supposed to be flags? not used currently

p << (uint32) time(0); // time - not currently used

m_bot->GetSession()->HandleMoveTeleportAck(p);

--- 2401,2407 ----

if (m_bot->IsBeingTeleportedNear())

{

WorldPacket p = WorldPacket(MSG_MOVE_TELEPORT_ACK, 8 + 4 + 4);

! p.appendPackGUID(m_bot->GetGUID());

p << (uint32) 0; // supposed to be flags? not used currently

p << (uint32) time(0); // time - not currently used

m_bot->GetSession()->HandleMoveTeleportAck(p);

Link to comment
Share on other sites

Can you fix the code attached above?

Edited:

Please use code tag in the future...

Sorry,

I'm new to this forum. Do you mean a link to the file? I do not have or a member of a ftp site (e.g pastebin), and my server is only on for part of the day. If getmangos.eu has means to store files, let me know? I know my messages can be longwinded, but that me ;)

P.S Is the code patch broken? I used the patch on my server before submitting this, and it worked.

(copy & paste to file. Execute in source root, patch -p1 < my.patch)

Cheers

Link to comment
Share on other sites

revert teleport patch, some more paladin work.

@blueboy - your need or greed update has default after 0 cases, i am testing your new teleport fix now(interesting approach none the less). also, thank you for taking the time to explain each patch and the process you used to come up with it. so a special thanks to blueboy for all the recent work on playerbot. sry, i wish i had more time for testing(i didnt even notice the bug in last teleport change til LordPsyan posted) but between being busy and not playing WoW as much in my free time(damn why does modern warfare have to be sooo good :)) oh and Stillhard meant by post as code plz use the (code)example(/code)

your playerbotai patch should look like this:

diff --git a/src/game/PlayerbotAI.cpp b/src/game/PlayerbotAI.cpp
index 77c6a1f..009d3bd 100644
--- a/src/game/PlayerbotAI.cpp
+++ b/src/game/PlayerbotAI.cpp
@@ -2401,7 +2401,7 @@ void PlayerbotAI::HandleTeleportAck()
    if (m_bot->IsBeingTeleportedNear())
    {
        WorldPacket p = WorldPacket(MSG_MOVE_TELEPORT_ACK, 8 + 4 + 4);
-        p << m_bot->GetGUID();
+        p.appendPackGUID(m_bot->GetGUID());
        p << (uint32) 0; // supposed to be flags? not used currently
        p << (uint32) time(0); // time - not currently used
        m_bot->GetSession()->HandleMoveTeleportAck(p);

OR if adding code(like the need or greed patch):

case CMSG_LOOT_ROLL:
       {

           WorldPacket p(packet); //WorldPacket packet for CMSG_LOOT_ROLL, (8+4+1)
           uint64 Guid;
           uint32 NumberOfPlayers;
           uint8 rollType;
           p.rpos(0); //reset packet pointer
           p >> Guid; //guid of the item rolled
           p >> NumberOfPlayers; //number of players invited to roll
           p >> rollType; //need,greed or pass on roll


           for (PlayerBotMap::const_iterator it = GetPlayerBotsBegin(); it != GetPlayerBotsEnd(); ++it)
               {

                   uint32 choice = urand(0,2); //returns 0,1,or 2

                   Player* const bot = it->second;
                   if(!bot)
                       return;

                   Group* group = bot->GetGroup();
                   if(!group)
                       return;

                   switch (group->GetLootMethod())
                       {
                       case GROUP_LOOT:
                           // bot random roll
                           group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);
                           break;
                       case NEED_BEFORE_GREED:
                           choice = 1;
                           // bot need roll
                           group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);
                           break;
                       case MASTER_LOOT:
                           choice = 0;
                           // bot pass on roll
                           group->CountRollVote(bot->GetGUID(), Guid, NumberOfPlayers, choice);
                           break;
                       default:
                           break;
                       }

                   switch (rollType)
                       {
                       case ROLL_NEED:
                           bot->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);
                           break;
                       case ROLL_GREED:
                           bot->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1);
                           break;
                       }

               }
       return;
       }

this makes life easier for ppl wanting to test your work :D

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