Advertisement
nevadies

Untitled

Sep 28th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. class Morph_Stone : public ItemScript
  2. {
  3. public: Morph_Stone() : ItemScript("Morph_Stone"){}
  4. char chrmsg[200];
  5.  
  6. bool OnUse(Player* player, Item* item, SpellCastTargets const& targets)
  7. {
  8. player->PlayerTalkClass->ClearMenus();
  9. //fun stuff
  10. player->ADD_GOSSIP_ITEM_EXTENDED(0, "|cff1EFF0C Morph|r", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1, "", 0, true);
  11. player->ADD_GOSSIP_ITEM(0, "|cff1EFF0C Demorph|r", GOSSIP_SENDER_MAIN, 2);
  12. player->PlayerTalkClass->SendGossipMenu(907, item->GetGUID());
  13. return true;
  14. }
  15.  
  16. void OnGossipSelect(Player* player, Item* item, uint32 /*sender*/, uint32 action)
  17. {
  18. player->PlayerTalkClass->ClearMenus();
  19. switch (action)
  20. {
  21. //demorph
  22. case 2:
  23. {
  24. player->DeMorph();
  25. int32 DisplayId = player->GetDisplayId();
  26. //tell player
  27. sprintf(chrmsg, "|cff9cff00[Morph Stone] Default display Id restored to: %u.|r", DisplayId);
  28. ChatHandler(player->GetSession()).SendSysMessage(chrmsg);
  29. player->CLOSE_GOSSIP_MENU();
  30. break;
  31. }
  32. }
  33. }
  34.  
  35. void OnGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code)
  36. {
  37. player->PlayerTalkClass->ClearMenus();
  38. if (sender == GOSSIP_SENDER_MAIN)
  39. {
  40. switch (action)
  41. {
  42. case GOSSIP_ACTION_INFO_DEF + 1:
  43. {
  44. if (code > 0)
  45. {
  46. //convert const char to int
  47. uint32 CodeInt = atoi((char*)code);
  48.  
  49. if (CodeInt< 99999 && CodeInt> 1)//X less than max # && Greater than 1, Morph Player
  50. {
  51. //set display id
  52. player->SetDisplayId(CodeInt);
  53. //tell player
  54. sprintf(chrmsg, "|cff9cff00[Morph Stone] Display Id set to %u.|r", CodeInt);
  55. ChatHandler(player->GetSession()).SendSysMessage(chrmsg);
  56. }
  57. else
  58. {//Invalid Display ID
  59. //tell player
  60. sprintf(chrmsg, "|cff9cff00[Morph Stone] Not a valid display Id.|r");
  61. ChatHandler(player->GetSession()).SendSysMessage(chrmsg);
  62. }
  63. }
  64. player->CLOSE_GOSSIP_MENU();
  65. break;
  66. }
  67. }
  68. }
  69. }
  70. };
  71.  
  72. //void AddSC_Morph_Stone()
  73. {
  74. new Morph_Stone();
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement