Jump to content

kyle1

Members
  • Posts

    72
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Everything posted by kyle1

  1. Hi, BThallid Thank you for your contribution. Code looks ok but a bit redundant. I'd change it: 1) Use readPackGUID() instead of >> to get GUID 2) There is no need to read anything but GUID from incoming packet. 3) Add SetIgnoreUpdateTime(0); in the end to reset AI delay. 4) You used m_botState != BOTSTATE_DEADRELEASED Can't we resurrect player when he's a ghost?
  2. Mangos Version: MaNGOS/0.17.0 Revision 10592 Custom Patches: Playerbot SD2 Version: Revision [1838] Database Name and Version : YTDB 0.13.9 R567 How it SHOULD work: Some spells like buffs require target to be certain minimum level. Mangos checks this with SpellMgr::SelectAuraRankForLevel() which has code to select appropriate spell rank for target. How it DOES work: With standard client it works fine since client selects appropriate spell rank itself before sending cast packet to server. Mangos never finds lower rank if target's level is too low for given spell. I found it while working on Playerbot mod. Fix is simple. Looks more like typo: diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 970fe5b..b6582b6 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2300,7 +2300,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo, break; // if found appropriate level - if (level + 10 >= spellInfo->spellLevel) + if (level + 10 >= nextSpellInfo->spellLevel) return nextSpellInfo; // one rank less then Since Playerbot has some client functionality it needs this code to work. It would be nice if this would be fixed in the core to avoid same code called twice.
  3. Thank you BThallid. extractGuid() was written long ago by Playerbot creators when there was no core function for this. I believe we should drop extractGuid() in favor of packet method.
  4. Hi, blueboy. It is always nice to see improvements to Playerbot I wish I could help you with your rogue stuff, but time is problem for me now. Anyway today I had couple of hours to fix multiple items trading when linking several items at once. Code is in the portal repo. PS. I really miss PMs and AJAX here. Mangos crew were spartans to choose this BB.
  5. Both repos have been updated with a bugfix for bots not turning in quests on gameobjects.
  6. Warning !!! Do not use it on public server EVER! Ok, you've been warned. Here's a patch which adds ability to add bots from other accounts without any restrictions. Stability was not tested. Use it on your own risk. Botguy won't work. diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 69ef07b..d12d320 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -601,16 +601,17 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data ) // Playerbot mod. Can't easily reuse HandlePlayerLoginOpcode for logging in bots because it assumes // a WorldSession exists for the bot. The WorldSession for a bot is created after the character is loaded. -void PlayerbotMgr::AddPlayerBot(uint64 playerGuid) +void PlayerbotMgr::AddPlayerBot(uint64 playerGuid, uint32 accountId) { // has bot already been added? if (sObjectMgr.GetPlayer(playerGuid)) return; +/* uint32 accountId = sObjectMgr.GetPlayerAccountIdByGUID(playerGuid); if (accountId == 0) return; - +*/ LoginQueryHolder *holder = new LoginQueryHolder(accountId, playerGuid); if(!holder->Initialize()) { diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 066e77c..b2a5f1d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13119,7 +13119,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me } delete resultlvl; - GetPlayerbotMgr()->AddPlayerBot(guidlo); + GetPlayerbotMgr()->AddPlayerBot(guidlo, 0); // stub, won't work this->ModifyMoney(-(int32)cost); } break; @@ -15129,7 +15129,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) Field *fields = result->Fetch(); uint32 dbAccountId = fields[1].GetUInt32(); - +/* // check if the character's account in the db and the logged in account match. // player should be able to load/delete character only with correct account! if( dbAccountId != GetSession()->GetAccountId() ) @@ -15138,7 +15138,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) delete result; return false; } - +*/ Object::_Create( guid, 0, HIGHGUID_PLAYER ); m_name = fields[2].GetCppString(); @@ -16843,6 +16843,14 @@ void Player::SaveToDB() DEBUG_FILTER_LOG(LOG_FILTER_PLAYER_STATS, "The value of player %s at save: ", m_name.c_str()); outDebugStatsValues(); + uint32 account_id = GetSession()->GetAccountId(); + QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = '%u'", GetGUIDLow()); + if (result) + { + account_id = (*result)[0].GetUInt32(); + delete result; + } + CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM characters WHERE guid = '%u'",GetGUIDLow()); @@ -16860,7 +16868,7 @@ void Player::SaveToDB() "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, " "power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars) VALUES (" << GetGUIDLow() << ", " - << GetSession()->GetAccountId() << ", '" + << account_id << ", '" << sql_name << "', " << (uint32)getRace() << ", " << (uint32)getClass() << ", " diff --git a/src/game/playerbot/PlayerbotMgr.cpp b/src/game/playerbot/PlayerbotMgr.cpp index 217cc0d..94ee885 100644 --- a/src/game/playerbot/PlayerbotMgr.cpp +++ b/src/game/playerbot/PlayerbotMgr.cpp @@ -688,7 +688,7 @@ bool ChatHandler::HandlePlayerbotCommand(char* args) SetSentErrorMessage(true); return false; } - + /* uint32 accountId = sObjectMgr.GetPlayerAccountIdByGUID(guid); if (accountId != m_session->GetAccountId()) { @@ -696,7 +696,7 @@ bool ChatHandler::HandlePlayerbotCommand(char* args) SetSentErrorMessage(true); return false; } - + */ // create the playerbot manager if it doesn't already exist PlayerbotMgr* mgr = m_session->GetPlayer()->GetPlayerbotMgr(); if (!mgr) @@ -748,7 +748,7 @@ bool ChatHandler::HandlePlayerbotCommand(char* args) return false; } CharacterDatabase.DirectPExecute("UPDATE characters SET online = 1 WHERE guid = '%lu'", guid); - mgr->AddPlayerBot(guid); + mgr->AddPlayerBot(guid, m_session->GetAccountId()); PSendSysMessage("Bot added successfully."); } else if (cmdStr == "remove" || cmdStr == "logout") diff --git a/src/game/playerbot/PlayerbotMgr.h b/src/game/playerbot/PlayerbotMgr.h index b169023..ab6d504 100644 --- a/src/game/playerbot/PlayerbotMgr.h +++ b/src/game/playerbot/PlayerbotMgr.h @@ -29,7 +29,7 @@ class MANGOS_DLL_SPEC PlayerbotMgr void HandleMasterIncomingPacket(const WorldPacket& packet); void HandleMasterOutgoingPacket(const WorldPacket& packet); - void AddPlayerBot(uint64 guid); + void AddPlayerBot(uint64 guid, uint32 accountId); void LogoutPlayerBot(uint64 guid); Player* GetPlayerBot (uint64 guid) const; Player* GetMaster() const { return m_master; }; Have fun
  7. You won't get a "nice" raid with bots. Raids usually assume players to be smart, and bots are simply stupid. Also cross-account bots will need some kind of account binding, leading to security issues and extra intrusion into mangos core. It is not worth it imo.
  8. Have no git by my hand at the moment, so here is github fancy commit view: http://github.com/blueboy/portal/commit/602064d66ed9cc8917fa224fe4fd6466e861017b Regarding your patch, you moved spell finder above m_bot->CastSpell(pTarget, pSpellInfo, false); so it should not return you a valid Spell class instance pointer because such instance is not created yet. Btw I see if (!m_bot->IsWithinLOSInMap(pTarget)) in your patch, which was not committed to repository. Guess we should fix it It would be great to implement bot movement when there is a LOS problem, but I have no idea where to start here.
  9. I was coding the same stuff when you posted your patch, Kirix The idea in your patch is fine, but there is one problem in it. You use FindCurrentSpellBySpellId() before you actually cast a spell. Didn't tried it, but it should fail imho. Also calculating spell range every spell cast is a waste. It is much better to calculate ranges once and use it later. I've pushed new branch to portal repo called spell-range-map with my version of range checking. Anyway, I want to thank you for your efforts. The more we discuss and try, the better the code.
  10. Unfortunately AI was designed without clear view on ranged combat, and all class AIs do not expect to move bot into spell range before casting. Dragon's Breath casted from 25 yards looks funny and ineffective. This patch does its job, but we forget about range modifying talents. I think bot has to build a spell range map during spell initialization and fill in corrected range values for all its spells. I'm going to implement it as soon as I have free time. Mixing movement and casting without target change should go to TODO list, as it will improve caster bot performance a lot.
  11. If you play with mangos code it is handy to understand the way git works. Personally I use Pro Git book when there is a git question. You need to: 1) add blueboy remote repository 2) pull blueboy/master into your build branch. Could be like this: git remote add blueboy git://github.com/blueboy/mangos.git git checkout your-build-branch git pull blueboy master
  12. Hi. I've just added rogue poisons use to portal/temp-enchantments branch. Works for me, but no real testings were done. If I won't get any negative feedback this branch will be merged to master in a day.
  13. I have found the source of jerky movement. There are two actually. First one is MovementUpdate() method. When called it makes bot to slow down a little and speed up again without stops. I'd like to do more tests to decide if we really need it today, cos bots work without it. Second one is CastSpell() which is called a lot of times by class AI in the end of UpdateAI(). It has MovementClear() call within. Well, when my warlock bot casted all his buffs, he follows master without stops, but if master mounts, bot mounts too and loose some of his auras while being mounted. It makes him to call CastSpell() several times each AI update. The result: 2 seconds of following master, 2 seconds of resting. I hope to fix it in near future, so stay tuned UPD: I have fixed mounted movement interruptions in portal master. I still want more tests on MovementUpdate() calls, but bots shouldn't fall behind anymore. If they still do, then set debuglevel = 3 and look into log for something like: Bot movement reset for casting Detect Invisibility (132) when your bot stops, and post this info here. I just can't check all class AIs by myself ...
  14. I use 64-bit dual core Linux system at home. Client is being run on the same machine with server via Wine, sometimes there are two clients running, cos I have multiseat setup. Today I used another Linux PC for server and Windows PC for client. I need to research this issue more. Regarding delocalized-spells, I will merge it to master today. The only class AI that received changes was priest. It had some "logic" in spell init phase and I had to remove it. The cause of the change you noticed are normally working class AIs, using top ranks of spells known to bots. There are simply no other reasons for that. I wonder how many spells do init correctly by their names now?
  15. Hi. For a long time I experienced jerky bot movements when bot follows for 2 seconds and stays the same amount of time. After some research I made a hack which refreshes follow mode in each AI update, and bots started to follow master almost without interruption. Today I run the server on a slow celeron based PC and was surprised when bots followed master without any hacks. There is ~0.3 second pause in movement each AI tick, but bots do not fall behind generally. Both my systems run Ubuntu Lucid Lynx, the only difference is that first one is 64-bit and second is 32-bit. Did anyone has the same problem as I, and what system was that?
  16. Hi. I've just pushed new branch to portal called temp-enchantments. New code lets using items on another equipped items, which can be used by rogues with poisons, warlock with stones and so on. Right now there is an updated warlock AI which creates and uses firestones on bot's weapon.
  17. I have finished transferring spell initialization to locale independent algorithm. The code compiles at least on Linux. If you want to see what spellids are returned to bot, then set debuglevel = 3, and look into log for "initSpell: Found spellid: ". Spells not known to your bot won't be reported to log. Get the source at blueboy/portal branch delocalized-spells.
  18. I guess you're right. After I add racial traits all spells will be moved to their corresponding classes. UPD: Done.
  19. 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.
  20. 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.
  21. I've just pushed new branch to portal, delocalized-spells. Get it and test. Only mage was implemented.
  22. 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.
  23. 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...
  24. 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.
  25. 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.
×
×
  • 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