Advertisement
Deathsoul

Npc_tool

Jun 30th, 2013
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.08 KB | None | 0 0
  1. /* Made by: aaddss A.K.A Deathsoul
  2.    untested (in game)
  3. */
  4.  
  5.  
  6. #include "ScriptPCH.h"
  7.  
  8. class npc_tool : public CreatureScript
  9. {
  10.     public:
  11.         npc_tool() : CreatureScript("npc_tool"){}
  12.  
  13.         bool OnGossipHello(Player * pPlayer, Creature * pCreature)
  14.         {
  15.  
  16.             pPlayer->ADD_GOSSIP_ITEM(4, " Race Change 5 Tokens", GOSSIP_SENDER_MAIN, 0);
  17.             pPlayer->ADD_GOSSIP_ITEM(4, " Faction Change 10  Tokens", GOSSIP_SENDER_MAIN, 1);
  18.             pPlayer->ADD_GOSSIP_ITEM(4, " customize 1 Tokens", GOSSIP_SENDER_MAIN, 2);
  19.             pPlayer->ADD_GOSSIP_ITEM(4, " rename 1 Tokens", GOSSIP_SENDER_MAIN, 3);
  20.             pPlayer->PlayerTalkClass->SendGossipMenu(9425, pCreature->GetGUID());
  21.             return true;
  22.         }
  23.  
  24.         bool OnGossipSelect(Player * Player, Creature * Creature, uint32 /*uiSender*/, uint32 uiAction)
  25.         {
  26.             if(!Player)
  27.                 return true;
  28.  
  29.             switch(uiAction)
  30.             {
  31.                 case 0:
  32.                     if(Player->HasItemCount(12345, 5)) // race change token (12345) you can change it
  33.                     {
  34.                         Player->DestroyItemCount(12345, 5, true, true); // race change token (12345) you can change it
  35.                         Player->DestroyItemCount(12345, 5, true, false); // race change token (12345) you can change it
  36.                         Player->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
  37.                         CharacterDatabase.PExecute("UPDATe characters Set at_login = at_login | '128' Where guid = %u", Player->GetGUID());
  38.                         Player->GetSession()->SendNotification("You need to relog, to change your race!");
  39.                         Player->PlayerTalkClass->CloseGossip();
  40.                     }
  41.                     else
  42.                     {
  43.                         Player->GetSession()->SendNotification("You need atleast 5 race change token!");
  44.                         Player->PlayerTalkClass->CloseGossip();
  45.                     }
  46.                     break;
  47.                 case 1:
  48.                     if(Player->HasItemCount(123, 10)) // race change token (123) you can change it
  49.                     {
  50.                         Player->DestroyItemCount(123, 10, true, true); // race change token (123) you can change it
  51.                         Player->DestroyItemCount(123, 10, true, false); // race change token (123) you can change it
  52.                         Player->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
  53.                         CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '64' WHERE guid = %u", Player->GetGUID());
  54.                         Player->GetSession()->SendNotification("You need to relog, to change your faction!");
  55.                         Player->PlayerTalkClass->CloseGossip();
  56.  
  57.                     }
  58.  
  59.                     else
  60.                     {
  61.                         Player->GetSession()->SendNotification("you need atleast 10 faction change token!");
  62.                         Player->PlayerTalkClass->CloseGossip();
  63.                     }
  64.                     break;
  65.                 case 2:
  66.                     if(Player->HasItemCount(152, 1)) // customize change token (152) you can change it
  67.                     {
  68.                         Player->DestroyItemCount(152, 1, true, true); // customize change token (152) you can change it
  69.                         Player->DestroyItemCount(152, 1, true, false); // customize change token (152) you can change it
  70.                         Player->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
  71.                         CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = %u", Player->GetGUID());
  72.                         Player->GetSession()->SendNotification("you need to relog, to change your customize!");
  73.                         Player->PlayerTalkClass->CloseGossip();
  74.  
  75.                     }
  76.  
  77.                     else
  78.                     {
  79.                         Player->GetSession()->SendNotification("you need atleast 1 customize change token!");
  80.                         Player->PlayerTalkClass->CloseGossip();
  81.                     }
  82.                     break;             
  83.                 case 3:
  84.                     if(Player->HasItemCount(152, 1)) // name change token (1552) you can change it
  85.                     {
  86.                         Player->DestroyItemCount(1552, 1, true, true); // name change token (1552) you can change it
  87.                         Player->DestroyItemCount(1552, 1, true, false); // name change token (1552) you can change it
  88.                         Player->SetAtLoginFlag(AT_LOGIN_RENAME);
  89.                         CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = %u", Player->GetGUID());
  90.                         Player->GetSession()->SendNotification("you need to relog, to change your name!");
  91.                         Player->PlayerTalkClass->CloseGossip();
  92.  
  93.                     }
  94.  
  95.                     else
  96.                     {
  97.                         Player->GetSession()->SendNotification("you need atleast 1 name change token!");
  98.                         Player->PlayerTalkClass->CloseGossip();
  99.                     }
  100.                     break;
  101.             }
  102.             return true;
  103.         }
  104. };
  105.  
  106. void AddSc_npc_tool()
  107. {
  108.     new npc_tool();
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement