Advertisement
Guest User

errors

a guest
Jan 29th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. /*
  2. _______ _____ _______ _______ _______
  3. | ___| \| ___| | | | |
  4. | ___| -- | ___| | | |
  5. |_______|_____/|_______|__|_|__|_______|
  6. Copyright (C) 2013 EmuDevs <http://www.emudevs.com/>
  7.  
  8. This program is free software; you can redistribute it and/or modify it
  9. under the terms of the GNU General Public License as published by the
  10. Free Software Foundation; either version 2 of the License, or (at your
  11. option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful, but WITHOUT
  14. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. more details.
  17.  
  18. You should have received a copy of the GNU General Public License along
  19. with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. class npc_arena_teamTop : public CreatureScript
  22. {
  23. public:
  24. npc_arena_teamTop() : CreatureScript("npc_arena_teamTop") { }
  25.  
  26. bool OnGossipHello(Player* player, Creature* creature)
  27. {
  28. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "View top 2v2 Arena Teams", GOSSIP_SENDER_MAIN, 1);
  29. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "View top 3v3 Arena Teams", GOSSIP_SENDER_MAIN, 2);
  30. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Nevermind", GOSSIP_SENDER_MAIN, 3);
  31. player->SEND_GOSSIP_MENU(1, creature->GetGUID());
  32. return true;
  33. }
  34.  
  35. bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions)
  36. {
  37. player->PlayerTalkClass->ClearMenus();
  38. if (actions == 1)
  39. {
  40. QueryResult result = CharacterDatabase.Query("SELECT name, rating FROM arena_team WHERE type='2' ORDER BY rating DESC LIMIT 10");
  41. if(!result)
  42. return false;
  43.  
  44. do
  45. {
  46. Field* fields = result->Fetch();
  47. std::string arena_name = fields[0].GetString();
  48. uint32 rating = fields[1].GetUInt32();
  49. ChatHandler(player->GetSession()).PSendSysMessage("Team Name: |cffFFFF00%s|r, Team Rating: %u \n", arena_name.c_str(), rating);
  50. player->MonsterWhisper(msg, player);
  51. }while(result->NextRow());
  52. }
  53. else if (actions == 2)
  54. {
  55. QueryResult result = CharacterDatabase.Query("SELECT name,rating FROM arena_team WHERE type='3' ORDER BY rating DESC LIMIT 10");
  56. if(!result)
  57. return false;
  58.  
  59. do
  60. {
  61. Field* fields = result->Fetch();
  62. std::string arena_name = fields[0].GetString();
  63. uint32 rating = fields[1].GetUInt32();
  64. ChatHandler(player->GetSession()).PSendSysMessage("Team Name: |cffFFFF00%s|r, Team Rating: %u \n", arena_name.c_str(), rating);
  65. }while(result->NextRow());
  66. }
  67.  
  68. player->CLOSE_GOSSIP_MENU();
  69. return true;
  70. }
  71. };
  72.  
  73. void AddSC_npc_arena_setup()
  74. {
  75. new npc_arena_teamTop;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement