Jump to content

klunk

Members
  • Posts

    37
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Everything posted by klunk

  1. Sorry for not replying sooner. I think my code may be a little behind Blue's code, and I have done stuff to make it work with a later revision, I forget off hand. As for the vcproj files, I dont use them so I made a hack at resolving conflicts, obviously not very well.
  2. These are all link errors, rather than compile. Are there any errors further up in the output that you have missed? Are you compiling a clean build or doing an incremental compile? I would suggest doing make clean followed by make and seeing if it persists.
  3. OK, my repository now includes the functionality to sell junk items to the vendor selected by the player. Whisper sell junk to the bot and they will sell all junk items. Buyback items will then be available to the player, not the bot, however this does not work quite right as the icon and item name do not appear for the player. The player can buy the item back though without any problems. This is not tested for BoP items. If I can I will change this to add it to the bots buyback and give a buyback function to the bot. latest repo, merged with [9254] from core and latest ScriptDev2 available at http://github.com/klunk/mangos.git [9524] builds on Linux (Ubuntu 9.04 64bit and 9.10 32 bit)
  4. The following code snippet will list the items that the bot has, as you say it gives no indication of how many empty slots the bot has but it does list their invetory. I took this from the trade functionality, removing the tradeable check, for the sell function. It also lists the item level (0 for junk) and once I figure out how to actually sell an item I will write a sell junk command. else if (text == "sell") { // list out items available for trade std::ostringstream out; // list out items in main backpack for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++) { const Item* const pItem = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (pItem) { const ItemPrototype* const pItemProto = pItem->GetProto(); std::string itemName = pItemProto->Name1; const uint32 itemQuality = pItemProto->Quality; ItemLocalization(itemName, pItemProto->ItemId); out << " " << itemQuality << " |cffffffff|Hitem:" << pItemProto->ItemId << ":0:0:0:0:0:0:0" << "|h[" << itemName << "]|h|r"; if (pItem->GetCount() > 1) out << "x" << pItem->GetCount() << ' '; } } // list out items in other removable backpacks for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; ++bag) { const Bag* const pBag = (Bag*) m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag); if (pBag) { for (uint8 slot = 0; slot < pBag->GetBagSize(); ++slot) { const Item* const pItem = m_bot->GetItemByPos(bag, slot); if (pItem) { const ItemPrototype* const pItemProto = pItem->GetProto(); std::string itemName = pItemProto->Name1; const uint32 itemQuality = pItemProto->Quality; ItemLocalization(itemName, pItemProto->ItemId); // item link format: [url]http://www.wowwiki.com/ItemString[/url] // itemId, enchantId, jewelId1, jewelId2, jewelId3, jewelId4, suffixId, uniqueId out << " " << itemQuality << " |cffffffff|Hitem:" << pItemProto->ItemId << ":0:0:0:0:0:0:0" << "|h[" << itemName << "]|h|r"; if (pItem->GetCount() > 1) out << "x" << pItem->GetCount() << ' '; } } } }
  5. There are addons (arkinventory for example) that will show you the bags of othe characters, however this relies on cached information and you having logged on to the caracter to fill the cache. I am sure something could be done along the same lines.
  6. Sounds like a good idea to me. Its something I would have liked last week when I was playing about with bots, its only really an extension of the trade functionality that lists the bag contents isnt it?
  7. I do check the bags can store the item in my [atch and if it cannot I give an error message. To be honest though, I didnt test this by filling up my bots bag.
  8. I should also have mentioned, my repo is currently at Mangos [9183]. I need to bring it up to date.
  9. I have pushed my first change through to my git repository, please feel free to pull it down from there. The change is denoted with the initials SJW. This change allows the player to select a vendor and whisper buy to the bot. The bot will then list the items available from the vendor and you can then whisper buy <itemlink> and the bot will purchase it if they have enough money and bag space. The bot needs to be close enough to the vendor to trade with it. I wanted to give some feedback on the success of the trade, but other than checking the bag space before buying I cannot do it, the BuyItemFromVendor returns a boolean but it seems to always be false, regardless if the purchase worked or not, which was my problem last night. I was actually buying it (and filling my bag) but it kept telling me it couldn't buy. I am more than happy for people to give pointers on how to improve what I have done. The next step is to sell items and more importantly junk.
  10. Me again I am very close to completing the buy side, only problem I have is that the call to BuyItemFromVendor on m_bot is failing and I cant see why at the moment. Once I have buy working I will update my repo and make it available for people to test.
  11. That is so good, thanks. It works a treat. Now to actually purchase the item.
  12. Hi Blueboy If you have code to translate the item guids to names and quantities I would appreciate that. I will be looking at that this evening, but if i can crib yours I can concentrate on the code to actually make the purchase Thanks
  13. I will try this tonight, thanks. It looks like you only change the type mask to indicate vendor and added some logging, is that right? Obviously this is my approach to iterative development, change something and see what result it give, building up over a series of edits to a final solution, hence some unnecessary code in there. One question, did you experience my wired jumping back in the code issue with my original code sample or did it work fine for you? Do you run this through gdb at all?
  14. I have an odd problem, seen both in Anjuta and Eclipse with the C++ dev environment. I am working on the Playerbot code trying to get the bot to talk to a vendor, nothing more than talk at the moment, but when I step thru the code I get strange behaviour, I hit the breakpoint for a call to GetPlayer()->GetNPCIfCanInteractWith(...), step over that and can see that the call returns a non-null value, however when I step over the next line the debugger jumps back to the GetPlayer()->GetNPCIfCanInteractWith(...) line which this time returns NULL. My first thoughts were threading but Eclipse is telling me I am in the same thread for both calls, and I dont understand why it would call the method twice anyway.
  15. I am a Linux user, but never done C++ on Linux (Java commercially and about 10 years ago I did commercial C++ on Windows). so what do people use to develop code and more interestingly to debug, especially on Linux? Thanks Klunk
  16. You could achieve the action bar effect with macros saying /w bot cast x or /w bot use x and binding them to your keys
  17. For some reason edit post does not work for me, so here is the code I am trying to add to the HandleCommand method of PlayerbotAI.cpp, anywhere in the if statements to handle the various comands. // SJW - Conversation with NPC will go here else if ((text == "buy") || (text == "buy ") || (text.size() > 4 && text.substr(0, 4) == "buy ")) { const uint64 playerSelection = fromPlayer.GetSelection( ); Object* const pNpc = ObjectAccessor::GetObjectByTypeMask(*m_bot, playerSelection, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!pNpc) { SendWhisper ("Selected player is not an NPC I can talk to.", fromPlayer); return; } Creature* const creature = fromPlayer.GetNPCIfCanInteractWith(playerSelection, TYPEMASK_UNIT); if (text == "buy" || text =="buy ") { std::ostringstream itemsOut; if (!creature) { SendWhisper ("Barf.", fromPlayer); return; } const VendorItemData* items = creature->GetVendorItems (); if (items->Empty()) { SendWhisper("This vendor does not have items I can buy.", fromPlayer); } uint64 index = 0; for (index = 0; index < items->GetItemCount ();++index) { const VendorItem* item = items->GetItem(index); itemsOut << item->item << "|r"; } ChatHandler ch(&fromPlayer); SendWhisper("Here are the items I can buy", fromPlayer); ch.SendSysMessage(itemsOut.str().c_str()); // SendWhisper("Buying!!!", fromPlayer); } SendWhisper("I dont know how to do that yet!!!", fromPlayer); }
  18. Does anyone have a routine that gets a Creature object from a guid? I am trying to write a routine that will buy from an NPC, I can get the bot to accept the message and I am trying to run : Creature* const creature = fromPlayer.GetNPCIfCanInteractWith(playerSelection, TYPEMASK_UNIT); I have also tried using a pointer m_bot instead of fromPlayer, the method gets called correctly once and I step over the next line, only to jump back to the line above when I continue. I dont understand why it is doing that, I can only presume it is a threading issue of some sort.
  19. I am not sure that will be possible, I think that will probably require a change in the client.
  20. Just FYI. I have started to look at getting the bot to interact with NPCs better. I will start with vendors so it can buy and sell items, potentially giving an instruction to sell junk automatically and repair automatically. The next step will be to buy items and finally to train individual or all spells. Firstly does anyone have any issue with this, or has anyone already started looking at it? Secondly, does anyone know (from memory) how to establish the location of an NPC/Creature so I can get the bot to walk towards it? I was thinking of getting the bot to target the NPC and if it is within a certain distance to move there. The trouble is how do I convert an name supplied on whisper to an NPC? There seems to be some position data on the creature struct which I thought I might be able to use.
  21. Ah, should that be in a SQL script already? Something in mangos core? Maybe it should be submitted to the core developers.
  22. Lots of questions, and I promise at some point I will start providing some answers. When I was playing with the bot last night it seems that the bot player does not get XP for discovering areas and does not get the completed on the explore quests. the second of this can be found with a quest in Goldshire to explore a kobold mine to the south. I had to log on the bot character and run into the mine to get the quest completion. Is this a known issue? Is there a jira/trac/issue site for playerbot? I also noticed that sometimes, when I speak to a trainer that also has a quest, I get a GOSSIP_ enum instead of a text label, this seems to be a mangos issue rather than playerbot but does anyone else see this?
  23. Yes, I am not sure that there is anything you can do with it, other than put up with it. If you want to party with real people and bots you will get noise because bots listen to party chat as well. The only way around it is a special bot channel just for bot commands but then how do you stop all bots on the system getting the messages. As for the floor issue I menioned, it seems to happen in the start areas, Human and Drainei but is fine in the city, stormwind.
  24. OK, so I managed to group with both bots and real people, interestingly if I type in /p with real people and bots I get a whisper from the bot every time. If its my bot it doesnt understand or someone elses it says speak to my master. Maybe have to have different chanels for real chat.
×
×
  • 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