Jump to content

[Patch] Auction House Bot (Xeross' Branch)


Recommended Posts

  • Replies 717
  • Created
  • Last Reply

Top Posters In This Topic

Hello there, I am currently trying to merge Auction House Bot with Playerbot (by blueboy)

Anyone can give me some advices?

i like to help you, but i don't know where to start...BlueBoy tought me alot... about using git.. making patches. how to edit them, and so many things.. one what o/s are you using ? how much do you know about git ? I only use ahbot and playbot only. So ill try to help you

Link to comment
Share on other sites

Hi madmax765!

Well, my mangos is running on ubuntu server 9.10. About git, well, I am currently trying to work it out, how all the options in git are working. Normally I am working with SVN. My current problem is to create a patch of auction house bot with current HEAD of mangos. Some advice in that would be a great help. The method mentioned in the first post is just modifing some *.frm files, and is missing the whole modification of the core.

I got a script running, which is pulling the current head of mangos, then creating a ahbot branch and fetching ahbot into it. after that I am running "git diff master ahbot > ../ahbot.patch". Am I missing something?

Link to comment
Share on other sites

Hi,

Iowahc wrote:

I got a script running, which is pulling the current head of mangos, then creating a ahbot branch and fetching ahbot into it. after that I am running "git diff master ahbot > ../ahbot.patch". Am I missing something?

If it is any help I have a script to create the auctionhousebot patch from cyberium's github.

#!/bin/bash -x
git clone git://github.com/mangos/mangos.git cyberium
cd cyberium
git fetch git://github.com/cyberium/mangos.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

Then to apply

git apply --check --whitespace=fix ahbot.patch

If no conflicts, run again without --check

Understanding patch structure

git patch are usually composed of two set of code patterns (3 line pattern), one above and one below the modification (lines begining with either a '-' or '+' symbol).

You may get conflicts due to core changes. The only main conflict with playerbot is in World.cpp

Example: (line numbers may differ)

Initial patch from ahbot.patch

@@ -1318,6 +1354,9 @@ void World::SetInitialWorldSettings()
    // Delete all characters which have been deleted X days before
    Player::DeleteOldCharacters();

+    sLog.outString("Initialize AuctionHouseBot...");
+    sAuctionBot.Initialize();
+
    sLog.outString( "WORLD: World initialized" );

    uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime());

Initial MaNGOS code, 1317 to 1326 World.cpp

1316    uint32 nextGameEvent = sGameEventMgr.Initialize();
1317    m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);    //depend on next event
1318
1319    // Delete all characters which have been deleted X days before
1320    Player::DeleteOldCharacters();
1321
1322    sLog.outString( "WORLD: World initialized" );
1323
1324    uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime());
1325    sLog.outString( "SERVER STARTUP TIME: %i minutes %i seconds", uStartInterval / 60000, (uStartInterval % 60000) / 1000 );
1326}

You see from the ahbot.patch that the upper & lower 3 line pattern matches the 3 lines in the game file World.cpp.

Now after you apply playerbot, the MaNGOS code in World.cpp will change

Revised MaNGOS code, 1332 to 1339 World.cpp

1331    //Check playerbot config file version
1332    if (botConfig.GetIntDefault("ConfVersion", 0) != PLAYERBOT_CONF_VERSION)
1333        sLog.outError("Playerbot: Configuration file version doesn't match expected version. Some config variables may be wrong or missing.");
1334
1335    sLog.outString( "WORLD: World initialized" );
1336
1337    uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime());
1338    sLog.outString( "SERVER STARTUP TIME: %i minutes %i seconds", uStartInterval / 60000, (uStartInterval % 60000) / 1000 );
1339}

You will now have to copy and paste the upper 3 line pattern from the above revised World.cpp, to replace that in the ahbot.patch, thus

Final (working) patch from ahbot.patch

@@ -1318,6 +1354,9 @@ void World::SetInitialWorldSettings()
    if (botConfig.GetIntDefault("ConfVersion", 0) != PLAYERBOT_CONF_VERSION)
       sLog.outError("Playerbot: Configuration file version doesn't match expected version. Some config variables may be wrong or missing.");

+    sLog.outString("Initialize AuctionHouseBot...");
+    sAuctionBot.Initialize();
+
    sLog.outString( "WORLD: World initialized" );

    uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime());

N.B When you paste the 3 line pattern, always add a space at the start of each line of the pattern, or the patch will be corrupt.

Hope this helps

Link to comment
Share on other sites

Well, I currently have another problem.

When applying the patch, and fixing the problem with world.cpp, I get other conflicts

error: patch failed: contrib/dbcEditer/SearchFrm.dfm:1
error: contrib/dbcEditer/SearchFrm.dfm: patch does not apply
error: patch failed: contrib/dbcEditer/TitleFrm.dfm:1
error: contrib/dbcEditer/TitleFrm.dfm: patch does not apply
error: patch failed: contrib/dbcEditer/bin/update.txt:1
error: contrib/dbcEditer/bin/update.txt: patch does not apply
error: patch failed: contrib/dbcEditer/dbcedit.dfm:1
error: contrib/dbcEditer/dbcedit.dfm: patch does not apply
error: patch failed: contrib/dbcEditer/pjDbcEditer.bpr:1
error: contrib/dbcEditer/pjDbcEditer.bpr: patch does not apply

Any suggestions?

Link to comment
Share on other sites

Hi,

I wasn't aware that auctionhousebot changed anything in 'contrib/dbcEditer/'

I have checked and the script I gave you does create a patch containing changes to code in 'contrib/dbcEditer/' and this doesn't make any sense.

The script should create a patch showing all changes in cyberium's repository since the last MaNGOS commit [10654].

Looking at cyberium's repository in the 'ahbot' branch it is clear that a change has occured.

name age message

/dbcEditer/ September 05, 2010 Fix for annoying encoding

The contrib can contain binary files (precompiled code). 'git diff' by default does not handle these. If you want the patch to handle binary files then add --binary as an option.

git diff --binary $HASH > ahbot.patch

I don't think these changes have anything to do with auctionhousebot. My advice would be to remove the offending code from the patch you created before you apply it.

Hope this helps

Link to comment
Share on other sites

Hello again, I successfully merged ahbot, playerbot and wowarmory. but ingame, the auctionhouse is empty, am I missing any configuration? I set up the mangosd.conf and also added SQL-Tables and Data in SQL.

First thing.. you don't need a database for ahbot anymore.. second the configurations aren't in mangosd.conf anymore.. you will find it separately in /src/game/AuctionHouseBot/ahbot.conf.dist.in

And make sure you get ahbot from here https://github.com/cyberium/mangos/tree/new_ahbot/

Link to comment
Share on other sites

hello guys! it is great to see that ahbot patch is still continued even after all this time. now i am running into the same problems like someone posted above with that error message: Patch does not apply... the only thing is that i get that with all the files in mangos core and finally the patch that i get is about 11mb.

i am kind of lost with git so my question would be: can any1 post a patch that contains only the ahbot changes so i can apply it to mangos? or some step by step commands on how i can get it myself. thanks and i appreciate all the work that you people put in this project.

cheers!

Link to comment
Share on other sites

hello guys! it is great to see that ahbot patch is still continued even after all this time. now i am running into the same problems like someone posted above with that error message: Patch does not apply... the only thing is that i get that with all the files in mangos core and finally the patch that i get is about 11mb.

i am kind of lost with git so my question would be: can any1 post a patch that contains only the ahbot changes so i can apply it to mangos? or some step by step commands on how i can get it myself. thanks and i appreciate all the work that you people put in this project.

cheers!

After you have your mangos repository downloaded.. you just right click on the rep folder and select Git Bash Here. A command window will appear.. then just paste this

git pull git://github.com/cyberium/mangos.git new_ahbot

and then press enter and it should merge ahbot with your repository, compile mangos.. and your done :P

Link to comment
Share on other sites

will it merge without any conflicts or anything?

edit: yeah it seems it did with yesterday's mangos rev...

can i do the same for playerbot? and if so which branch is the correct one to pull from?

thanks :D

Well that I don't know.. I don't use Playerbot.. but I imagine there is a Git repository.. search the forum and you will find it :D

Link to comment
Share on other sites

Oky, i'll try to update it on my side to match a server installation

Does "git diff master ahbot > ../ahbot.patch" works, or you need to put all these numbers?

"git diff 4bbb824c8088d28d9736bea51edcda586c471901 ahbot > ../ahbot.patch"

If you need the numbers, are they gonna change over time?

Also, is the config still the exact same thing as before but in a separate file or things have change in there?

If so, can someone perhaps copy past the content here? thanks

Oh Xeross, could it be possible to change the example on your first post to match the real installation, i'm having a hard time trying to figure how to get to make the patch file...but i understand that the branch may have changed

the example:

"How to check out

git clone git://github.com/xeross/mangos.git ahbot

cd ahbot

git checkout -b ahbot origin/ahbot

git diff 4bbb824c8088d28d9736bea51edcda586c471901 ahbot > ../ahbot.patch"

"

what Blueboy wrote

#!/bin/bash -x

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

cd cyberium

git fetch git://github.com/cyberium/mangos.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

what i had:

git clone git://github.com/xeross/mangos.git ahbot

cd ahbot

git checkout -b ahbot origin/ahbot

git diff master ahbot > ../ahbot.patch

i'm trying to make the changes without having to test it... :| i'm not home right now and i'm not much into reinstalling everything for fun

Thanks

Link to comment
Share on other sites

Hi temporary,

The number you refer to is the commit history hash and yes this is unique for each commit. I believe both the scripts will work, it's your choice which one you use. I like the script I posted :P because it is quite flexible.

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

Is a clever script given to me by skinlayers that searches the commit history for the string pattern highlighted above (in single quotes) and returns the appropriate hash. This one looks for the first occurence of the characteristic MaNGOS commits version, with format

[1****]

If you wish to create a small patch that includes all changes in the code from a specific commit, select a unique string pattern in the commit history description and replace the hightlighed pattern above, with this string pattern.

Example of a commit, obtained from 'git log'

commit bd1aca465eae0b0bc5be5b4377642d596c4e2baa

Author: imaginary@email

Date: Tue Sep 14 14:25:23 2010 +0200

This commit will solve all your problems

Use the string pattern solve all your, to characterise this commit and the script will return bd1aca465eae0b0bc5be5b4377642d596c4e2baa

Hope this helps

Link to comment
Share on other sites

So, if i understand well after reading it 6 times... :rolleyes:

By using the Hash number, you would only pinpoint a certain commit. Commit witch would mean a change in the software.

Threw this hash number you would be able to copy those changes into a patch

Now, my question would be, how do i know witch commit is the AHBot since the only thing we want is the AHBot in the patch?

And my second question would be: does "master" includes all the commits...since basicly the person only keep in the git repository the AHBot with the basic Mangos, it would indeed, only get the AHBot ....

Am i correct?

If i would be using your code:

#!/bin/bash -x rem what is this line for?

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

cd cyberium

git fetch git://github.com/cyberium/mangos.git ahbot:ahbot

rem what is the use of fetch here if i was doiing git checkout -b ahbot origin/ahbot

git checkout ahbot

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

rem what all these other stuff fow... --pretty=oneline?

git diff $HASH > ahbot.patch

oh and yeah before you ask, my knowledge of git is basicly ...nothing...i know other language but i have no idea about this... why i've bin able to make the document with all the information, i've asked questions arround just like now...and i tried until i suceeded. Thanks

Link to comment
Share on other sites

why the use of git diff and hashes for a simple checkout? seems like that whole process is overly complicated, or is it so one could see the changes before actually trying to apply the patch?

Since AHBot is a branch off of the mangos project could one not just use git pull and merge the remote branch with a local copy of the mangos master?

git clone git://github.com/mangos/mangos.git mangos
cd mangos
git pull git://github.com/cyberium/mangos.git new_ahbot

wouldn't that work for a fresh local copy, or does the cyberium branch have to have the mangos master commits merged to it first? (I'm still new to git as well)

of course with an existing copy that's already been merged you'd want to do a reset/rebase to get the local copy back to the original master state, update the local master, then merge ahbot and that's where you'd need the commit hash to know which state to go back to

Edit: Nevermind temporary, I missed in your post that you were trying to create the patch file.. what i said above would only merge the branches without needing/making a patch file (at least after reading git docs, I believe it would)

Link to comment
Share on other sites

The easy way to create patch from my repo

git clone git://github.com/cyberium/mangos.git new_ahbot
cd new_ahbot
git checkout new_ahbot
git diff master > ../ahbot.patch

//aply patch
go to your repository (of course in bash mode)
git apply ../ahbot.patch

If you want only merge new_ahbot patch

//from your repo

git pull git://github.com/cyberium/mangos.git new_ahbot

Thats all :)

Link to comment
Share on other sites

Hi Temporary,

Like I said in my last post, both scripts would work. If you are unfamiliar with git, and the unix environment use

git clone git://github.com/cyberium/mangos.git new_ahbot
cd new_ahbot
git checkout new_ahbot
git diff master > ../ahbot.patch

Understanding scripts and git is more involved, where do I start :rolleyes:

#!/bin/bash -x

Tells the system where to find the *nix bash shell utility. -x is bash debug option that echo each line of the script as it executes.

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

will clone (every commit) the whole of the MaNGOS repository git://github.com/mangos/mangos.git to your harddrive, and place it in a folder cyberium.

Now this is your local master branch (clean MaNGOS code set to the HEAD of the branch - latest code)

Check this by typing

git branch
* master

The git fetch command merges the remote branch ahbot from cyberium's repository, with a newly created local branch, also call ahbot.

git fetch git://github.com/cyberium/mangos.git ahbot:ahbot

Then switch from the local master branch, to the newly created local ahbot branch

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

Now --pretty=oneline is a 'git log' option that does what it says. It abbreviates the info for each commit on one line. Try entering and see

git log --pretty=oneline

The output is then piped (redirected) to the input of the grep utility (*nix search) that locates the first occurence of the search pattern and returns the associated hash in script variable $HASH

git diff $HASH > ahbot.patch

echo the difference in code between the local ahbot branch from commit ($HASH) and directs the output to a file ahbot.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