MichaelCrow

Untitled

Apr 25th, 2022
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.95 KB | None | 0 0
  1. class item_generic_thread : public ItemScript
  2. {
  3. public:
  4.     item_generic_thread() : ItemScript("item_generic_thread") {}
  5.  
  6.     bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override
  7.     {
  8.  
  9.         uint32 itementryid = item->GetEntry();
  10.  
  11.         enum reagantList
  12.         {
  13.             RHINO_HAIR = 123,
  14.             SPIDER_HAIR = 124,
  15.             BODY_HAIR = 125
  16.         };
  17.  
  18.         enum threadtypes
  19.         {
  20.             WOOL_THREAD = 12345,
  21.             SILK_THREAD = 12346,
  22.             OTHER_THREAD = 12347
  23.         };
  24.  
  25.         if (item)
  26.         {
  27.             switch (itementryid)
  28.             {
  29.             case RHINO_HAIR:
  30.                 if (player->GetItemCount(RHINO_HAIR, 10))
  31.                 {
  32.                     player->DestroyItemCount(RHINO_HAIR, 10, true);
  33.                     player->AddItem(WOOL_THREAD, 1);
  34.                 }
  35.                 else
  36.                     player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr);
  37.                 break;
  38.  
  39.             case SPIDER_HAIR:
  40.                 if (player->GetItemCount(SPIDER_HAIR, 10))
  41.                 {
  42.                     player->DestroyItemCount(SPIDER_HAIR, 10, true);
  43.                     player->AddItem(SILK_THREAD, 1);
  44.                 }
  45.                 else
  46.                     player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr);
  47.                 break;
  48.  
  49.             case BODY_HAIR:
  50.                 if (player->GetItemCount(BODY_HAIR, 10))
  51.                 {
  52.                     player->DestroyItemCount(BODY_HAIR, 10, true);
  53.                     player->AddItem(OTHER_THREAD, 1);
  54.                 }
  55.                 else
  56.                     player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr);
  57.                 break;
  58.  
  59.                 //in case you get no itemid at all, fuck if i know how though lol
  60.             default:
  61.                 break;
  62.  
  63.                 return true;
  64.             }
  65.         }
  66.     }
  67. };
Add Comment
Please, Sign In to add comment