Jump to content

[PATCH] AuctionHouse Bot


Recommended Posts

Wouldn't it be the easiest way simply revert 8302? Or re-apply the function? Just because mangos doesn't use it anymore mustn't mean ahbot shouldn't use it anymore.

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 044739e..087b6f7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -13851,6 +13851,61 @@ void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, u
/***                   LOAD SYSTEM                     ***/
/*********************************************************/

+bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
+{
+    bool delete_result = true;
+    if (!result)
+    {
+        //                                        0     1     2     3           4           5           6    7          8          9         10    11
+        result = CharacterDatabase.PQuery("SELECT guid, data, name, position_x, position_y, position_z, map, totaltime, leveltime, at_login, zone, level FROM characters WHERE guid = '%u'",guid);
+        if (!result)
+            return false;
+    }
+    else
+        delete_result = false;
+
+    Field *fields = result->Fetch();
+
+    if (!LoadValues( fields[1].GetString()))
+    {
+        sLog.outError("Player #%d have broken data in `data` field. Can't be loaded for character list.",GUID_LOPART(guid));
+        if (delete_result)
+            delete result;
+        return false;
+    }
+
+    // overwrite possible wrong/corrupted guid
+    SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
+
+    m_name = fields[2].GetCppString();
+
+    Relocate(fields[3].GetFloat(),fields[4].GetFloat(),fields[5].GetFloat());
+    SetLocationMapId(fields[6].GetUInt32());
+
+    // the instance id is not needed at character enum
+
+    m_Played_time[PLAYED_TIME_TOTAL] = fields[7].GetUInt32();
+    m_Played_time[PLAYED_TIME_LEVEL] = fields[8].GetUInt32();
+
+    m_atLoginFlags = fields[9].GetUInt32();
+
+    // I don't see these used anywhere ..
+    /*_LoadGroup();
+
+    _LoadBoundInstances();*/
+
+    if (delete_result)
+        delete result;
+
+    for (int i = 0; i < PLAYER_SLOTS_COUNT; ++i)
+        m_items[i] = NULL;
+
+    if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
+        m_deathState = DEAD;
+
+    return true;
+}
+
void Player::_LoadDeclinedNames(QueryResult* result)
{
    if(!result)
diff --git a/src/game/Player.h b/src/game/Player.h
index d31a575..f951af9 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1335,6 +1335,7 @@ class MANGOS_DLL_SPEC Player : public Unit

        bool LoadFromDB(uint32 guid, SqlQueryHolder *holder);

+        bool MinimalLoadFromDB(QueryResult *result, uint32 guid);
        static bool   LoadValuesArrayFromDB(Tokens& data,uint64 guid);
        static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index);
        static float  GetFloatValueFromArray(Tokens const& data, uint16 index);

And so far it seem to work :)

But I'm just a mangos "hobby-user" without big C++ knowledge so you better check twice ;) or wait for Naicisum to come up with a better version.

Regards

Skirnir

Link to comment
Share on other sites

  • Replies 702
  • Created
  • Last Reply

Top Posters In This Topic

The MaNGOS [8302] patch was reverted for this patch, will need to keep the code up to date until new AHBot-005 is released, my hope is to remove the dependency on using a player account and simply use a creature GUID. I was trying to use the normal LoadFromDB method but was too involved to keep this revision moving forward instead of focusing on new version.

@Skirnir

I was hoping switching to use LoadFromDB would be simple, but since that function moved to use a SqlQueryHolder object, the complexity increased. I worked on it for a couple of hours, but in the best interest of developement for the next version, decided it would at this point be better to simply focus on eliminating the need for a player account for the new version.

Link to comment
Share on other sites

So earlier I asked how to apply the .patch file to the latest Mangos .

First: I use the git gui program for Windows. So what I do is copy this

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

cd ahbot

git checkout origin/ahbot

git checkout -b ahbot

git diff master ahbot > auctionhousebot.patch

Second: I make a folder called ahbot on c drive. After I make that folder, I right click on that folder

and select Git Bash Here. A command window will pop up. I right click the top bar and

Select edit past, it will past what we coped above. It should start download all the files

to the folder we right clicked on. after its done, Close command window.

Third: So open the folder you made I'll call it ahbot from now own out.

In that folder it makes another folder with the same name, and all the files are there.

I cut all the files out of that folder and past theme all to the first folder ahbot.

I delete the other ahbot folder after I cut the files out of it.

Forth: So now I have the files in c:\\ahbot folder in that folder there is a .patch file

That's the file we use to patch Mangos. Right click the folder

The one you will be compiling Mangos in. Should have all the files in this folder

from the Mangos Git the latest version. select Git Bash Here.

Command window will pop up like befor this time all you need to do is type

This command in git apply c:/ahbot/auctionhousebot.patch

After you type that in press your Enter key. after the next line comes up it will be doen its fast.

Close the command window. That's it your Mangos now has the ahbot applyed to it.

Compile it like you regularly do and set up ahbot after wards have funn!!!!

That's how you use git for windows to apply the ahbot patch to the latest Mangos.

"Note Just Compiled MaNGOS [8325] and applyed the AHBOT like my windows tutorial shows.

No errors.

So as of right now you don't have to revert MaNGOS and it runs smooth as butter.

Link to comment
Share on other sites

Nice !

This works fine for me, thanks Naicisum for the update of your repo, i really appreciate your work.

No offence, but the tutorial from Power12 seems way to complicated for me.

Here is what i do on a 2K3 Machine with GIT Bash...

 
git clone git://github.com/mangos/mangos.git
cd mangos
git pull git://github.com/Naicisum/mangos.git ahbot

Then compile as usual.

Since the invention of GIT around here this works flawless for me, first with Paradox repo, now with Naicisum repo, is there any disadvantage of this method i should be aware of ?

Anyway, here is something i noticed while testing the AHBOT:

When you are in the AH and browse goods, where e.g. Tradegoods - Elemental 5 pages of items are shown and you are on page 5, then change to Tradegoods - Herb (2 pages - less then 5 pages) you will see an empty page.

You could browse backwards until an utilized page is viewed but you could also browse again the empty pages.

In some cases you have "respeak" to the actioneer to get browsing to work proper again.

Is it just me, the AHBOT or MaNGOS ?

Link to comment
Share on other sites

@power12: that is a lot more complicated than necessary .. Fatty is doing it right (with the exception that you don't need to clone again to get new changes), you should stop thinking in the old svn way of getting a patch that you can apply and learn how to pull/fetch+merge from remote branches.

Link to comment
Share on other sites

I never really used this patch, gave a quick try to original bot + buyer from Paradox/Kerbe, I just have a few suggestions for this topic's author.

  • * It would be a nice to post http link to your repo in the first post, when I wanted to take a look, I had to manually write it using the git:// version. It isn't really a big deal, but it helps.
    * Looks like your git work is very well limited to local branches. I, in fact, almost never use local branches. I make some stuff, commits along the way, then push it to some hosting. I'm able to use remotename/remotebranch as a referency. My HEAD is very dynamic, so it really serves well. What does this mean for you? Really nothing, but you could simplify a lot of things for yourself, the "diff creation" described on front page can be done using single command (excluding clone) - see below.
    * This list point is reserved for everything I forgot during the creation of the second point :(
    * A good idea would be to perhaps rename "master" to "upstream" or so. That will disable initial default checkout after git clone (which can be suppressed by -n switch OR when there's no master branch).

Anyway, the diff output can be reduced from

git clone git://github.com/Naicisum/mangos.git ahbot
cd ahbot
git checkout origin/ahbot
git checkout -b ahbot
git diff master ahbot > auctionhousebot.patch

to something like

git clone -n git://github.com/Naicisum/mangos.git ahbot
cd ahbot
git diff origin/master origin/ahbot > auctionhousebot.patch

or in existing mangos repo:

git fetch git://github.com/Naicisum/mangos.git master
cat .git/FETCH_HEAD    # copy the output to clipboard or simply scroll up later
git fetch git://github.com/Naicisum/mangos.git ahbot
git diff a1b2c3d FETCH_HEAD > auctionhousebot.patch

could be done in a nicer way, but this way it gets garbage-collected over time (since it's not needed). a1b2c3d is the output from "cat" command.

The last solution will probably be the quickest one if the user has already pulled from clean mangos / got the objects from any other ref. I guess like ~30 seconds for the first one, ~20 seconds for the second one and ~3 seconds for the last one - raw processing time.

Sorry for duplication of anyone in this thread already suggested that.

Link to comment
Share on other sites

The MaNGOS [8302] patch was reverted for this patch, will need to keep the code up to date until new AHBot-005 is released, my hope is to remove the dependency on using a player account and simply use a creature GUID.

That is a good news. If you finally use one/several auctioneers NPC to sell/buy items, then this AH bot patch may be considered to be included in core.

Link to comment
Share on other sites

I don't talk about coding style since I did not even read the code.

The fact is that this bot is probably a functionality that can be included since Offy seams to have same kind of bot too. But the way it currently uses a user account and a character is the reason it was never considered.

Link to comment
Share on other sites

not sure if it´s just me but...

Does anyone else have any problems with the "Return Mail" feature after installing ahbot?

and no i´m not saying to hit "Return Mail" on a mail sent from the auction house, but i mean normal usage

like player A to player B, then return back to player A

i´ve had some random crashes, but with no errors in the logs or anything..just plain old segmentation fault

can others test this and see if they get this problem? thank you in advance

also used different compiles with different DBs and it still happens, so i wanna know if it´s AHBot...

btw if this is in the wrong area, Im sorry in advance

nvm, user error on my behalf xP

Link to comment
Share on other sites

not sure if it´s just me but...

Does anyone else have any problems with the "Return Mail" feature after installing ahbot?

and no i´m not saying to hit "Return Mail" on a mail sent from the auction house, but i mean normal usage

like player A to player B, then return back to player A

i´ve had some random crashes, but with no errors in the logs or anything..just plain old segmentation fault

can others test this and see if they get this problem? thank you in advance

also used different compiles with different DBs and it still happens, so i wanna know if it´s AHBot...

btw if this is in the wrong area, Im sorry in advance

nvm, user error on my behalf xP

Testing Testing I just checked that for you, I'm running MaNGOS [8325] and applyed the AHBOT

Mail is working fine here had some one sent me mail and I clicked the Return Mail button.

No Errors at all and thay got there mail back. by the way what version of MaNGOS you useing?

I just seen this===> nvm, user error on my behalf.

But just to clear the air mail is working fine.

Link to comment
Share on other sites

A quick question about how to auction your items. I have found that since I have enabled buyer that if I set prices on my items just as if I was on a blizzard server my items dont get bid on. So what is a good way to test to see if the buyer is working and where would i look to changing the way AHBot bids on items.

Link to comment
Share on other sites

@killsakiller

Here are the values that are important. In your mangos.conf look to the following value:

  • AuctionHouseBot.UseBuyPriceForBuyer

This value dictates what value the buyer will use in the formula, SellPrice (0) or BuyPrice (1). This value will be refered to in the formula below as <Item Base Cost>

Inside the characters database, auctionhousebot table, the following columns are important. I also show the default values that comes with the bot initially:

  • * buyerpricegrey = 1
    * buyerpricewhite = 1
    * buyerpricegreen = 5
    * buyerpriceblue = 12
    * buyerpricepurple = 15
    * buyerpriceorange = 20
    * buyerpriceyellow = 22

Those values are the multiplier used in the formula based off of color. This value will be refered to in the formula below as <Multiplier>

The Forumula:

<Item Base Cost> * <Multiplier> * <Stack Count> = <Max Cost>

For example, lets imagine a white item that has a cost of 10 copper and we are selling only 1, then the max cost would be represented as:

10 * 1 * 1 = 10

Lets do another example item, lets imagine a blue item that costs 50 copper and we are going to sell 3 of them, then the max cost would be represented as:

50 * 12 * 3 = 1800

1800 translates into 18 silver 0 copper

One last example, lets say we have a purple item that costs 1 gold 50 silver 20 copper and we sell 10 of them, then the max cost would be represented as:

15020 * 15 * 10 = 2253000

2253000 translates into 225 gold 30 silver 00 copper

As long as the price on the item you place for auction using the above formula is LESS that the max price, your item should be purchased.

Please keep in mind this is NOT taking into account how many bids you allow the BOT to bid on, or how many player items are up for auction.

The item also has to have a BASE cost to begin with, if vendors dont want to buy it, the auctionbot wont buy it either.

Link to comment
Share on other sites

Ok I am still having problems. I setup a second server just for testing this and I still can't get AHBot to buy anything, I am hoping I just overlooked something really simple. First off the AH is being populated with items so I know that AHBot is Running. I am the only one other than the Auctioneer bot with items in the AH. I adjusted the config to unbalanced values just to see if it would buy anthing.

These are my settings from the mangosd.conf

AuctionHouseBot.EnableSeller = 1

AuctionHouseBot.EnableBuyer = 1

AuctionHouseBot.Account = 8

AuctionHouseBot.GUID = 10

AuctionHouseBot.VendorItems = 1

AuctionHouseBot.LootItems = 1

AuctionHouseBot.OtherItems = 1

AuctionHouseBot.No_Bind = 1

AuctionHouseBot.Bind_When_Picked_Up = 0

AuctionHouseBot.Bind_When_Equipped = 1

AuctionHouseBot.Bind_When_Use = 1

AuctionHouseBot.Bind_Quest_Item = 0

AuctionHouseBot.ItemsPerCycle = 500

AuctionHouseBot.UseBuyPriceForSeller = 0

AuctionHouseBot.UseBuyPriceForBuyer = 0

and here is my SQL Dump

('2', 'Alliance', '7500', '10000', '8', '24', '1', '26', '12', '10', '1', '0', '0', '3', '10', '27', '8', '2', '0', '0', '100', '150', '150', '250', '800', '1400', '1250', '1750', '2250', '4550', '3250', '5550', '5250', '6550', '70', '100', '70', '100', '80', '100', '75', '100', '80', '100', '80', '100', '80', '100', '20', '20', '20', '2', '1', '1', '1', '100', '100', '100', '100', '100', '100', '100', '1', '100');

INSERT INTO `auctionhousebot` VALUES

('6', 'Horde', '7500', '10000', '8', '24', '1', '26', '12', '10', '1', '0', '0', '3', '10', '27', '8', '2', '0', '0', '100', '150', '150', '250', '800', '1400', '1250', '1750', '2250', '4550', '3250', '5550', '5250', '6550', '70', '100', '70', '100', '80', '100', '75', '100', '80', '100', '80', '100', '80', '100', '20', '20', '20', '2', '1', '1', '1', '100', '100', '100', '100', '100', '100', '100', '1', '100');

INSERT INTO `auctionhousebot` VALUES

('7', 'Neutral', '2500', '5000', '8', '24', '1', '26', '12', '10', '1', '0', '0', '3', '10', '27', '8', '2', '0', '0', '100', '150', '150', '250', '800', '1400', '1250', '1750', '2250', '4550', '3250', '5550', '5250', '6550', '70', '100', '70', '100', '80', '100', '75', '100', '80', '100', '80', '100', '80', '100', '20', '20', '20', '2', '1', '1', '1', '100', '100', '100', '100', '100', '100', '100', '1', '100');

I have tested with several differnt items, all of which have sell values i.e Gold Bar (green item) Sells to vendor for 6s I have a stack of 20 and the buyerpricegreen is set to 100. so 600 * 100 *20 = 1200000 or 120g. as you can see i have the bot bidding every min atm so and since I am the only player he should be buying my items. So yeah I dont know what is going on.

I dont know if it makes a differance, but I have playerbot installed as well.

Link to comment
Share on other sites

Hello, Im having a problem with this patch.

look the world.exe:

http://img22.imageshack.us/i/asddsp.jpg/

but when i compiled the game, it said

(========== Build: 11 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========)

The problem is that in the AH I cant see the items added by the "patch". Actually its empty.

I've seen people that his mangosd.exe when its about to load, it says

Initialize AuctionHouseBot...

AuctionHouseBot:

loaded 3 grey trade goods

loaded 560 white trade goods

loaded 66 green trade goods

loaded 28 blue trade goods

loaded 3 purple trade goods

loaded 1 orange trade goods

loaded 0 yellow trade goods

loaded 1255 grey items

loaded 2696 white items

loaded 5433 green items

loaded 1690 blue items

loaded 606 purple items

loaded 0 orange items

loaded 0 yellow items

but mine doesnt shows up that.

any ideas? Im pretty sure I added the codes good in the sources and in my conf file its enable .

btw ive added 2 times the code manually, and 2 times patching.

Link to comment
Share on other sites

@killsakiller

The formula is good, however it must always be less than the max value for it to sell, which is why i suggested subtracting 1 from max value which is the same as 1 copper.

@Namesis

Not sure, but if your mangos output dosent show the "Initialize AuctionHouseBot..." etc etc, then your source isint patched/compiled correctly. Im not sure how to patch outside of using git, ive used msysgit which is basically git for windows...

Ref: http://code.google.com/p/msysgit/

@Everyone

I will be going on vacation starting this saturday for three full weeks returning back to the grind on the 14th of September, I will try to keep the repo updated but there may be gaps in the days when this occurs. I ask for your patience and will try to keep the repo updated when I get a chance. Thanks!

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