Jump to content

Naicisum

Members
  • Posts

    43
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Everything posted by Naicisum

  1. @Derex I havent begin heavy testing to see it break yet, but sync errors such as? Do you see any glaring issues? Since the class is implemented as a Singleton and Instanced only once as long as its referenced with auctionmgr key word, it will all use the same class object. Or so i thought was my understanding. It's all a learning experience to me, but i would love to develop this idea to one day get fully implemented.
  2. I have been in communication with Paradox via GitHub, he has been managing this for the Trinity fork and I've pretty much taken over management for the MaNGOS tree on this forum. This version is built apon the last version that Paradox posted before i started making changes. The 2nd post in this thread shows where you can fetch the original code which I beleive GigElf is still hosting on his github fork. I keep my repo pretty much update with the MaNGOS tree about once a day. I regularly regenerate a patch and apply it to my servers and have not experienced any issues. Posts on this thread are small, so i dont think a lot of people are experiencing issues. Still running strong on my servers, AHBot posts and maintains around 60K auctions per server, and ive personally had the AHBuyer purchase over 40 items at once without any issues. I have not personally experienced any crashed, however please keep in mind that I only run MaNGOS with SD2 and AHBot, no other patches are applied to my servers.
  3. Yeah, it will basically split out the cpu cycles and work to another thread to work on. But just for the AuctionHouseMgr class. So for instance if you have like 20000 auctions that expired, instead of holding the entire server up while all those process, it queues the update which processes in another thread and the server continues to function normally. The ACE_DEBUG lines are for outputting info messages which show the thread number that its running under to verify its working. Those are not needed for the final version. It was late when i posted, wanted to get it out there before i fell asleep. It could use a little revision and cleanup, but if anyone was interested in testing this (keep in mind this is completely experimental and i give no guarentees of stability) then give it a shot. I am going to stress test it with the AuctionHouse Bot later on and watch its performance, but since this is such a change to core, i felt it needed to be submitted as a seperate modification all togeather. @davemm/moderator Could you rename this thread to: [Patch] Threading AuctionHouseMgr its not necessarily multi-threading the AuctionHouseMgr but rather having that process in a seperate single thread.
  4. Heres a patch I kind of whipped togeather. I havent fully tested it out to see if it catches all the places, but for the most part, it seems to be working in small simple cases. I figure this will be the beginning part of it. What do you guys thnk? diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index ed8a059..95a94b6 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -35,6 +35,11 @@ #include "Policies/SingletonImp.h" +#ifdef WIN32 +#include "ServiceWin32.h" +extern int m_ServiceStatus; +#endif + INSTANTIATE_SINGLETON_1( AuctionHouseMgr ); AuctionHouseMgr::AuctionHouseMgr() @@ -47,6 +52,40 @@ AuctionHouseMgr::~AuctionHouseMgr() delete itr->second; } +void AuctionHouseMgr::run() +{ + ACE_DEBUG + ((LM_DEBUG, ACE_TEXT ("(%t) Handler Thread running\\n"))); + + runUpdate = false; + initLoading = false; + + LoadAuctionItems(); + LoadAuctions(); + + initLoading = true; + + while (!World::IsStopped()) + { + if (runUpdate) + { + Update(); + runUpdate = false; + } + + #ifdef WIN32 + ACE_Based::Thread::Sleep(50); + #else + ACE_Based::Thread::Sleep(100); + #endif + + #ifdef WIN32 + if (m_ServiceStatus == 0) World::StopNow(SHUTDOWN_EXIT_CODE); + while (m_ServiceStatus == 2) Sleep(1000); + #endif + } +} + AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap( uint32 factionTemplateId ) { if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) @@ -278,6 +317,8 @@ void AuctionHouseMgr::SendAuctionExpiredMail( AuctionEntry * auction ) void AuctionHouseMgr::LoadAuctionItems() { + ACE_DEBUG + ((LM_DEBUG, ACE_TEXT ("(%t) LoadAuctionItems Thread running\\n"))); // data needs to be at first place for Item::LoadFromDB QueryResult *result = CharacterDatabase.Query( "SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid" ); @@ -331,6 +372,8 @@ void AuctionHouseMgr::LoadAuctionItems() void AuctionHouseMgr::LoadAuctions() { + ACE_DEBUG + ((LM_DEBUG, ACE_TEXT ("(%t) LoadAuctions Thread running\\n"))); QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse"); if( !result ) { diff --git a/src/game/AuctionHouseMgr.h b/src/game/AuctionHouseMgr.h index 2775838..164f637 100644 --- a/src/game/AuctionHouseMgr.h +++ b/src/game/AuctionHouseMgr.h @@ -114,7 +114,7 @@ class AuctionHouseObject AuctionEntryMap AuctionsMap; }; -class AuctionHouseMgr +class AuctionHouseMgr : public ACE_Based::Runnable { public: AuctionHouseMgr(); @@ -152,7 +152,12 @@ class AuctionHouseMgr void Update(); + bool runUpdate; + bool initLoading; + private: + void run(); + AuctionHouseObject mHordeAuctions; AuctionHouseObject mAllianceAuctions; AuctionHouseObject mNeutralAuctions; diff --git a/src/game/World.cpp b/src/game/World.cpp index bf20ccf..7bf2501 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1309,8 +1309,13 @@ void World::SetInitialWorldSettings() ///- Load dynamic data tables from the database sLog.outString( "Loading Auctions..." ); sLog.outString(); - auctionmgr.LoadAuctionItems(); - auctionmgr.LoadAuctions(); + ACE_DEBUG + ((LM_DEBUG, ACE_TEXT ("(%t) Main Thread running\\n"))); + ACE_Based::Thread t(*new AuctionHouseMgr); + while(auctionmgr.initLoading == false) + ACE_Based::Thread::Sleep(100); + //auctionmgr.LoadAuctionItems(); + //auctionmgr.LoadAuctions(); sLog.outString( ">>> Auctions loaded" ); sLog.outString(); @@ -1529,7 +1534,8 @@ void World::Update(uint32 diff) } ///- Handle expired auctions - auctionmgr.Update(); + auctionmgr.runUpdate = true; + //auctionmgr.Update(); } /// [*] Handle session updates when the timer has passed
  5. I try to update my repo every couple of days to keep it in sync with the master branch. Try it again and let me know. I just performed the same steps on 8095 build with no issues.
  6. In both versions, purple items are defined as both regular items and trade goods. Please make sure you set both of them to 0 to completely eliminate purples from the auction bot. You can verify this has been done by examining the DB table 'auctionhousebot' and checking the values in percentpurpleitems and percentpurpletradegoods fields.
  7. This patch was modified and accepted under revision 8080 by Vlad. Please close and move this thread. Thanks!
  8. @svaike, et all. Please before posting that its not working for you, post the information i request under the FAQ entitled "Something is not working quite right, I need some help" this information is needed by me to reproduce issues if they exist or to correct configuration errors you might have not noticed. Thanks!
  9. @xzbbzx, cryoman, et all. Please before posting that its not working for you, post the information i request under the FAQ entitled "Something is not working quite right, I need some help" this information is needed by me to reproduce issues if they exist or to correct configuration errors you might have not noticed. Thanks!
  10. Do you have the buyer enabled in the config? Did you setup appropriate values for the buyer? The buyer uses the BuyerPrice<Color> variables. Do you have a lot of items up for bid? Did you set your buyer intervals up? By default the buyer will only bid on ONE item per minute. If the buyer finds an item but dosent buy it, its over, no more bids. Meaning if you have a bunch of overpriced items, you may never actually get it to buy one that is below the threashold. Lets run through an example blue item. The default is 12 for blue, so if you have an blue item you want to auction, go to the AH, put the item up. The auction house lists it for 1g 50s. Open calculator, enter in 15000, divide by 3, multiply by 2, this gives you 10000 or 1g, the vendor sell price. Now take 10000 and multiply by 12 (the buyer price), you will get 120000 or 12g. Subtract 1 copper to get 119999 or 11g 99s 99c, the auction bot will buy this item.
  11. I have updated/added answers to the FAQ section in the 2nd post. I will try to answer common questions in that section to prevent looking all over this thread for answers. @Xadiaris and Poe I have addressed your questions above.
  12. Author/History Information AuctionHouseBot was originally created by ChrisK and Paradox AHBuyer functionality was originally created by Kerbe and Paradox Current Release: AHBot-004-HotFix-06 I have made some significant changes to the code base. Mostly the fixes based off of AHBot-004 (my building versioning to keep things straight), include spacing correction, adding debugging output, fixing a lot of logic errors with switches, fixing a lot of memory issues with pointers which increases server stability. Other major changes include making AHBot into a Singleton class instead of just static functions. Corrected minor issue with addNewAuctionBuyerBotBid function causing buyer to not function if you never change default buyer bids interval from 1. Reverted MaNGOS [8302] because of dependency on using player account. HotFix-04 addresses the recent change with the mail system. HotFix-05 addresses the changes with the singleton macros. HotFix-06 addresses an issue with the code not removng expired auctions from the item_instance SQL table. Current Developement: AHBot-005-Alpha-005 More code changes posted. AHBot is now completely dynamic across all item types. What this means is that you will have greater granularity control. It is still very much a work in progress. Ive decided to do a dynamic data blob like whats in use in mangos, mostly due to the 1380 columns at present used by ahbot. I also decided to work on fewer core changes at present, I need to stay focused on the core changes I want to implement, get those done, commit, beta, and then convert and move forward with the next batch of changes. I am still going to make the override table functionality for single items for AHBot-005, but i need to wrap up some of the command/sql changes first, almost done on that. As always, i will try to post more detaied comments on whats changing/updating in the commit logs. But progress is still being made! My Github Branch Info: * master - exact replica of mangos/master, no custom changes to be applied ever. * ahbot - auctionhouse bot, pulls from naicisum/master * ahbot-dev - the next version of the auctionhouse bot, developmental code (unstable) * localfix - my local fixes i create here and there, mostly odds and ends. (unstable) My repository has been updated to the latest mangos version as of this posting/update [8780+]. If you wish to extract and create only the auctionhouse.patch file, please follow the following steps. (might be an easier way but this works) 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 Using the above method you should be able to apply that patch to any clean mangos repo version going forward if my repo gets out of date, of course unless the code changes significantly which causes the patch file to break. My Server: (Just friends, etc... Low volume/user server) Ref: http://www.directron.com/atomvalue.html OS: Fedora 11 x86_64 How I run my AHBot-004-HotFix-04: Config: AuctionHouseBot.EnableSeller = 1 AuctionHouseBot.EnableBuyer = 1 AuctionHouseBot.Account = <My Account ID> AuctionHouseBot.GUID = <My GUID ID> 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 = 1000 AuctionHouseBot.UseBuyPriceForSeller = 0 AuctionHouseBot.UseBuyPriceForBuyer = 0 SQL: (2,'Alliance',20000,30000,8,24,5,22,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,0,0,3,2,1,1,1,1,1,5,12,15,20,22,20,200) (6,'Horde',20000,30000,8,24,5,22,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,0,0,3,2,1,1,1,1,1,5,12,15,20,22,20,200) (7,'Neutral',20000,30000,8,24,5,22,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,0,0,3,2,1,1,1,1,1,5,12,15,20,22,20,200) This is not a powerful server by any means, but the auctionhouse bot runs all 3 auction houses seperate and has around 60K to 80K auction items total (in all 3) doing 1000 add operations per minute if the code dictates its needed. I also have the buyer enabled and it performs 200 purchases every 20 minutes depending on whats up there. I run a very stable server and performance is acceptable for this system.
  13. What bug does the patch fix? What features does the patch add? This patch will correct the output of the hexlike() function for ByteBuffer class For which repository revision was the patch created? 7917 Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread. Didn't find any. diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 6458976..5a13ea7 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -370,7 +370,7 @@ class ByteBuffer { if ((i == (j*8)) && ((i != (k*16)))) { - if (read<uint8>(i) < 0x0F) + if (read<uint8>(i) < 0x10) { sLog.outDebugInLine("| 0%X ", read<uint8>(i) ); } @@ -382,7 +382,7 @@ class ByteBuffer } else if (i == (k*16)) { - if (read<uint8>(i) < 0x0F) + if (read<uint8>(i) < 0x10) { sLog.outDebugInLine("\\n"); if(sLog.IsIncludeTime()) @@ -404,7 +404,7 @@ class ByteBuffer } else { - if (read<uint8>(i) < 0x0F) + if (read<uint8>(i) < 0x10) { sLog.outDebugInLine("0%X ", read<uint8>(i) ); }
  14. I was wondering if anyone saw any problems with this code or perhaps a better way to implement these partucular spells?
  15. What bug does the patch fix? What features does the patch add? This patch will add core/db support for spells 59502, 59503, 59504 For which repository revision was the patch created? 7846 Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread. Didn't find any. diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index c1cfd68..57b22b3 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2696,7 +2696,26 @@ void Spell::EffectCreateItem2(uint32 i) ((Player*)m_caster)->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell); return; } - DoCreateItem(i,m_spellInfo->EffectItemType[i]); + + // Add support for spells that create random loot items + switch(m_spellInfo->Id) + { + case 59502: // Inscription - Darkmoon Card + case 59503: // Inscription - Greater Darkmoon Card + case 59504: // Inscription - Darkmoon Card of the North + { + if(m_caster->GetTypeId()!=TYPEID_PLAYER) + return; + Player* player = (Player*)m_caster; + + // create some random items + player->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell); + return; + } + default: + DoCreateItem(i,m_spellInfo->EffectItemType[i]); + return; + } } void Spell::EffectPersistentAA(uint32 i) Supportng db code has been generated pending inclusion of code.
  16. What bug does the patch fix? What features does the patch add? - Hunter's pet incorrectly scales based on pet level and DBC values For which repository revision was the patch created? - 7814 Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread. - https://mangos.lighthouseapp.com/projects/18208/tickets/129-7814-bugpatch-hunters-pet-incorrectly-scales Who has been writing this patch? Please include either forum user names or email addresses. - me Reproduce Steps: Created night-elf hunter, set char level to 45 and learned associated training skills and pet training via quest. Go to Arathai Highlands, and train a raptor of level < 40. Should gain pet of L40 but size is too small. Verification: Did a tracepoint using VS2008 and evaluated the math, because its a mix of UInt32 and Float values the math is incorrectly calculated and the result ends up being only the value of cFamily->minScale (for raptor is 0.5f). By typecasting the UInt32's to floats, the correct value gets specified and used (level 40 raptor should be 0.695f) Proposed Fix: Add float type casts to calculation. scale = cFamily->minScale + (float)(getLevel() - cFamily->minScaleLevel) / (float)cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale); Patch: https://mangos.lighthouseapp.com/attachments/121767/7814_hunterpet.patch
  17. I have included links to the shell output i generate from trying to compile on a clean build as you will see. Initial Output: http://paste2.org/p/198766 Adding the #include <cstdio> one file at a time: http://paste2.org/p/199335
  18. Yeah, my bad. I updated the patch above to simply add the necessary includes.
×
×
  • 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