Advertisement
Guest User

Untitled

a guest
Jun 15th, 2011
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. #define ITEM_TELEPORT 123456
  2. #include "ScriptPCH.h"
  3. class npc_gp : public CreatureScript
  4. {
  5. public:
  6. npc_gp() : CreatureScript("npc_gp") { }
  7. bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
  8. {
  9. uint32 Enchants[19] = {
  10. 45056,
  11. 43987,
  12. 38991,
  13. 38972,
  14. 38986,
  15. 38990,
  16. 44458,
  17. 38978,
  18. 38995,
  19. 38992,
  20. 50368,
  21. 50370,
  22. 50369,
  23. 50367,
  24. 41602,
  25. 44963,
  26. 38373,
  27. 44957,
  28. 38374
  29. };
  30. uint32 Items[9] = {
  31. 35623,
  32. 35624,
  33. 36860,
  34. 35625,
  35. 35627,
  36. 35622,
  37. 36912,
  38. 36910
  39. };
  40.  
  41.  
  42. switch (uiAction)
  43. {
  44. uint32 pont;
  45. pont = CharacterDatabase.PQuery("SELECT `pont` FROM `guild` WHERE `guildid`='%d';"), pPlayer->GetGuildId();
  46. case GOSSIP_ACTION_INFO_DEF+1:
  47. if (pont >= 1 && pPlayer->isGuildMaster()) // Only the GM can buy
  48. {
  49. pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "100 GP -> 1000 gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
  50. pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get random level 80 material(Eternals, Bars etc. // 50GP).", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
  51. pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get a teleport credit(20GP(Tradeable)).", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
  52. pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get a random enchant(30GP).", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6);
  53. } else pCreature->MonsterWhisper("You might not a guild master or your Guild don't have got enought points", pPlayer->GetGUID(), false);
  54. break;
  55. case GOSSIP_ACTION_INFO_DEF+2:
  56. if (pont >= 100)
  57. {
  58. CharacterDatabase.PQuery("UPDATE `guild` SET `pont`='%d-100' WHERE `guildid`=%s", pont, pPlayer->GetGuildId());
  59. pCreature->MonsterWhisper("You've succesfully buyed 1000 gold!", pPlayer->GetGUID(), false);
  60. }
  61. else pCreature->MonsterWhisper("Your guild don't have enough GP", pPlayer->GetGUID(), false);
  62. break;
  63.  
  64. case GOSSIP_ACTION_INFO_DEF+3:
  65. if (pont >= 50)
  66. {
  67. uint32 randomitem = Items[urand(0, 10)];
  68. uint32 randomcount = urand(1, 20);
  69. pPlayer->AddItem(randomitem, randomcount);
  70. CharacterDatabase.PQuery("UPDATE `guild` SET `pont`='%d-50' WHERE `guildid`=%s", pont, pPlayer->GetGuildId());
  71. } else pCreature->MonsterWhisper("Your guild don't have enough GP.", pPlayer->GetGUID(), false);
  72. break;
  73.  
  74. case GOSSIP_ACTION_INFO_DEF+5:
  75. if (pont >= 20)
  76. {
  77. pPlayer->AddItem(ITEM_TELEPORT, 1);
  78. pCreature->MonsterWhisper("You got 1 x Teleport Coin.", pPlayer->GetGUID(), false);
  79. CharacterDatabase.PQuery("UPDATE `guild` SET `pont`='%d-20' WHERE `guildid`=%s", pont, pPlayer->GetGuildId());
  80. } else pCreature->MonsterWhisper("Your guild don't have enough GP.", pPlayer->GetGUID(), false);
  81. break;
  82. case GOSSIP_ACTION_INFO_DEF+6:
  83. if (pont >= 30)
  84. {
  85. uint32 randomenchant = Enchants[urand(0, 19)];
  86. pPlayer->AddItem(randomenchant, 1);
  87. pCreature->MonsterWhisper("You got 1 x Enchant.", pPlayer->GetGUID(), false);
  88. CharacterDatabase.PQuery("UPDATE `guild` SET `pont`='%d-30' WHERE `guildid`=%s", pont, pPlayer->GetGuildId());
  89. } else pCreature->MonsterWhisper("Your guild don't have enough GP.", pPlayer->GetGUID(), false);
  90. break;
  91. }
  92. return true;
  93. }
  94. bool OnGossipHello(Player* pPlayer, Creature* pCreature)
  95. {
  96. pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What can I do with my GPs?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  97. pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
  98. return true;
  99. }
  100. };
  101. void AddSC_npc_gp()
  102. {
  103. new npc_gp();
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement