Advertisement
Guest User

vendor.cpp

a guest
Aug 4th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. class VW_confirmation_test : public CreatureScript
  2. {
  3. public:
  4.     VW_confirmation_test() : CreatureScript("VW_confirmation_test") { }
  5.  
  6.     bool OnGossipHello(Player* player, Creature* creature) override
  7.     {
  8.         player->GetSession()->SendListInventory(creature->GetGUID());
  9.         return true;
  10.     }
  11.  
  12.     bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
  13.     {
  14.         OnGossipHello(player, creature);
  15.         uint64 guid = player->GetGUID();
  16.         ShoppingCart cart = sWorld->m_VW_shopping_cart;
  17.         ShoppingCart::const_iterator itr;
  18.  
  19.         if (cart.size() > 100)
  20.         {
  21.             cart.clear();
  22.             return false;
  23.         }
  24.  
  25.  
  26.         itr = cart.find(guid);
  27.         if (itr != cart.end())
  28.         {
  29.             player->AddItem(itr->second, 1);
  30.             ChatHandler(player->GetSession()).PSendSysMessage("you confirmed buying. map size = %u", cart.size());
  31.             cart.erase(itr);
  32.             return true;
  33.         }
  34.  
  35.         return false;
  36.     }
  37.  
  38.    
  39. };
  40.  
  41. void AddSC_confirmation_test()
  42. {
  43.     new VW_confirmation_test();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement