Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- _______ _____ _______ _______ _______
- | ___| \| ___| | | | |
- | ___| -- | ___| | | |
- |_______|_____/|_______|__|_|__|_______|
- Copyright (C) 2013 EmuDevs <http://www.emudevs.com/>
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
- You should have received a copy of the GNU General Public License along
- with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- class npc_arena_teamTop : public CreatureScript
- {
- public:
- npc_arena_teamTop() : CreatureScript("npc_arena_teamTop") { }
- bool OnGossipHello(Player* player, Creature* creature)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "View top 2v2 Arena Teams", GOSSIP_SENDER_MAIN, 1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "View top 3v3 Arena Teams", GOSSIP_SENDER_MAIN, 2);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Nevermind", GOSSIP_SENDER_MAIN, 3);
- player->SEND_GOSSIP_MENU(1, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions)
- {
- player->PlayerTalkClass->ClearMenus();
- if (actions == 1)
- {
- QueryResult result = CharacterDatabase.Query("SELECT name, rating FROM arena_team WHERE type='2' ORDER BY rating DESC LIMIT 10");
- if(!result)
- return false;
- do
- {
- Field* fields = result->Fetch();
- std::string arena_name = fields[0].GetString();
- uint32 rating = fields[1].GetUInt32();
- ChatHandler(player->GetSession()).PSendSysMessage("Team Name: |cffFFFF00%s|r, Team Rating: %u \n", arena_name.c_str(), rating);
- player->MonsterWhisper(msg, player);
- }while(result->NextRow());
- }
- else if (actions == 2)
- {
- QueryResult result = CharacterDatabase.Query("SELECT name,rating FROM arena_team WHERE type='3' ORDER BY rating DESC LIMIT 10");
- if(!result)
- return false;
- do
- {
- Field* fields = result->Fetch();
- std::string arena_name = fields[0].GetString();
- uint32 rating = fields[1].GetUInt32();
- ChatHandler(player->GetSession()).PSendSysMessage("Team Name: |cffFFFF00%s|r, Team Rating: %u \n", arena_name.c_str(), rating);
- }while(result->NextRow());
- }
- player->CLOSE_GOSSIP_MENU();
- return true;
- }
- };
- void AddSC_npc_arena_setup()
- {
- new npc_arena_teamTop;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement