SHOW:
|
|
- or go back to the newest paste.
1 | //Created By Philippovitch | |
2 | //AC-Web | |
3 | //Script Complete 100 % | |
4 | ||
5 | // Rewritten by Rochet2 | |
6 | - | using namespace std; |
6 | + | |
7 | - | |
7 | + | |
8 | - | /*Basic Menu*/ |
8 | + | |
9 | - | #define Menu_Whisp "NAME_SERVER Top Class killers" |
9 | + | /*Class E_Menu*/ |
10 | - | #define Notification "YOUR SERVER MESSAGE/NOTIFICATION" |
10 | + | |
11 | - | #define M_Whisper "YOUR SERVER MESSAGE/NOTIFICATION" |
11 | + | |
12 | - | #define leave "Nevermind" |
12 | + | |
13 | - | /*Class E_Menu*/ |
13 | + | |
14 | #define E_Priest "View top 5 Priest Killers" | |
15 | #define E_Shaman "View top 5 Shaman Killers" | |
16 | #define E_Mage "View top 5 Mage Killers" | |
17 | #define E_Warlock "View top 5 Warlock Killers" | |
18 | #define E_Druid "View top 5 Druid Killers" | |
19 | #define E_Death_knight "View top 5 Death knight Killers" | |
20 | /*Top 5 Message*/ | |
21 | #define M_Warrior "Here is the top 5 Warrior Killers" | |
22 | #define M_Paladin "Here is the top 5 Paladin Killers" | |
23 | #define M_Hunter "Here is the top 5 Hunter Killers" | |
24 | - | /*Top 5 Message*/ |
24 | + | |
25 | #define M_Priest "Here is the top 5 Priest Killers" | |
26 | #define M_Shaman "Here is the top 5 Shaman Killers" | |
27 | #define M_Mage "Here is the top 5 Mage Killers" | |
28 | #define M_Warlock "Here is the top 5 Warlock Killers" | |
29 | #define M_Druid "Here is the top 5 Druid Killers" | |
30 | #define M_Death_knight "Here is the top 5 Death knight Killers" | |
31 | ||
32 | class Top5_Killers : public CreatureScript | |
33 | { | |
34 | public: | |
35 | Top5_Killers() : CreatureScript("Top5_Killers") { } | |
36 | ||
37 | bool OnGossipHello(Player* player, Creature* creature) | |
38 | { | |
39 | - | Top5_Killers() : CreatureScript("Top5_Killers") { } |
39 | + | player->ADD_GOSSIP_ITEM(1, E_Warrior, GOSSIP_SENDER_MAIN, 1); |
40 | player->ADD_GOSSIP_ITEM(1, E_Paladin, GOSSIP_SENDER_MAIN, 2); | |
41 | - | bool OnGossipHello(Player* player, Creature* creature) |
41 | + | player->ADD_GOSSIP_ITEM(1, E_Hunter, GOSSIP_SENDER_MAIN, 3); |
42 | - | { |
42 | + | player->ADD_GOSSIP_ITEM(1, E_Rogue, GOSSIP_SENDER_MAIN, 4); |
43 | - | player->ADD_GOSSIP_ITEM(0, Menu_Whisp, GOSSIP_SENDER_MAIN, 0); |
43 | + | player->ADD_GOSSIP_ITEM(1, E_Priest, GOSSIP_SENDER_MAIN, 5); |
44 | - | player->ADD_GOSSIP_ITEM(1, E_Warrior, GOSSIP_SENDER_MAIN, 1); |
44 | + | player->ADD_GOSSIP_ITEM(1, E_Shaman, GOSSIP_SENDER_MAIN, 7); |
45 | - | player->ADD_GOSSIP_ITEM(1, E_Paladin, GOSSIP_SENDER_MAIN, 2); |
45 | + | player->ADD_GOSSIP_ITEM(1, E_Mage, GOSSIP_SENDER_MAIN, 8); |
46 | - | player->ADD_GOSSIP_ITEM(1, E_Hunter, GOSSIP_SENDER_MAIN, 3); |
46 | + | player->ADD_GOSSIP_ITEM(1, E_Warlock, GOSSIP_SENDER_MAIN, 9); |
47 | - | player->ADD_GOSSIP_ITEM(1, E_Rogue, GOSSIP_SENDER_MAIN, 4); |
47 | + | player->ADD_GOSSIP_ITEM(1, E_Druid, GOSSIP_SENDER_MAIN, 11); |
48 | - | player->ADD_GOSSIP_ITEM(1, E_Priest, GOSSIP_SENDER_MAIN, 5); |
48 | + | player->ADD_GOSSIP_ITEM(1, E_Death_knight, GOSSIP_SENDER_MAIN, 6); |
49 | - | player->ADD_GOSSIP_ITEM(1, E_Shaman, GOSSIP_SENDER_MAIN, 6); |
49 | + | player->SEND_GOSSIP_MENU(1, creature->GetGUID()); |
50 | - | player->ADD_GOSSIP_ITEM(1, E_Mage, GOSSIP_SENDER_MAIN, 7); |
50 | + | return true; |
51 | - | player->ADD_GOSSIP_ITEM(1, E_Warlock, GOSSIP_SENDER_MAIN, 8); |
51 | + | } |
52 | - | player->ADD_GOSSIP_ITEM(1, E_Druid, GOSSIP_SENDER_MAIN, 9); |
52 | + | |
53 | - | player->ADD_GOSSIP_ITEM(1, E_Death_knight, GOSSIP_SENDER_MAIN, 10); |
53 | + | bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) |
54 | - | player->ADD_GOSSIP_ITEM(1, leave, GOSSIP_SENDER_MAIN, 11); |
54 | + | { |
55 | - | player->SEND_GOSSIP_MENU(1, creature->GetGUID()); |
55 | + | player->PlayerTalkClass->ClearMenus(); |
56 | - | return true; |
56 | + | if (sender != GOSSIP_SENDER_MAIN) |
57 | - | } |
57 | + | return true; // wrong sender, something fisy |
58 | ||
59 | - | bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) |
59 | + | switch(action) |
60 | - | { |
60 | + | |
61 | - | if (sender == GOSSIP_SENDER_MAIN) |
61 | + | case 1: ChatHandler(player->GetSession()).PSendSysMessage(M_Warrior); break; |
62 | case 2: ChatHandler(player->GetSession()).PSendSysMessage(M_Paladin); break; | |
63 | - | player->PlayerTalkClass->ClearMenus(); |
63 | + | case 3: ChatHandler(player->GetSession()).PSendSysMessage(M_Hunter); break; |
64 | - | switch(action) |
64 | + | case 4: ChatHandler(player->GetSession()).PSendSysMessage(M_Rogue); break; |
65 | - | { |
65 | + | case 5: ChatHandler(player->GetSession()).PSendSysMessage(M_Priest); break; |
66 | - | case 12: |
66 | + | case 6: ChatHandler(player->GetSession()).PSendSysMessage(M_Death_knight); break; |
67 | - | player->ADD_GOSSIP_ITEM(0, Menu_Whisp, GOSSIP_SENDER_MAIN, 0); |
67 | + | case 7: ChatHandler(player->GetSession()).PSendSysMessage(M_Shaman); break; |
68 | - | player->ADD_GOSSIP_ITEM(1, E_Warrior, GOSSIP_SENDER_MAIN, 1); |
68 | + | case 8: ChatHandler(player->GetSession()).PSendSysMessage(M_Mage); break; |
69 | - | player->ADD_GOSSIP_ITEM(1, E_Paladin, GOSSIP_SENDER_MAIN, 2); |
69 | + | case 9: ChatHandler(player->GetSession()).PSendSysMessage(M_Warlock); break; |
70 | - | player->ADD_GOSSIP_ITEM(1, E_Hunter, GOSSIP_SENDER_MAIN, 3); |
70 | + | case 11: ChatHandler(player->GetSession()).PSendSysMessage(M_Druid); break; |
71 | - | player->ADD_GOSSIP_ITEM(1, E_Rogue, GOSSIP_SENDER_MAIN, 4); |
71 | + | default: return true; // invalid class, something fishy |
72 | - | player->ADD_GOSSIP_ITEM(1, E_Priest, GOSSIP_SENDER_MAIN, 5); |
72 | + | } |
73 | - | player->ADD_GOSSIP_ITEM(1, E_Shaman, GOSSIP_SENDER_MAIN, 6); |
73 | + | |
74 | - | player->ADD_GOSSIP_ITEM(1, E_Mage, GOSSIP_SENDER_MAIN, 7); |
74 | + | QueryResult result = CharacterDatabase.PQuery("SELECT name, totalKills FROM characters WHERE class = %u ORDER BY totalKills DESC LIMIT 5", action); |
75 | - | player->ADD_GOSSIP_ITEM(1, E_Warlock, GOSSIP_SENDER_MAIN, 8); |
75 | + | if(result) |
76 | - | player->ADD_GOSSIP_ITEM(1, E_Druid, GOSSIP_SENDER_MAIN, 9); |
76 | + | |
77 | - | player->ADD_GOSSIP_ITEM(1, E_Death_knight, GOSSIP_SENDER_MAIN, 10); |
77 | + | do |
78 | - | player->ADD_GOSSIP_ITEM(1, leave, GOSSIP_SENDER_MAIN, 11); |
78 | + | { |
79 | - | player->SEND_GOSSIP_MENU(1, creature->GetGUID()); |
79 | + | Field * fields = result->Fetch(); |
80 | - | break; |
80 | + | std::string name = fields[0].GetString(); |
81 | - | |
81 | + | uint32 totalKills = fields[1].GetUInt32(); |
82 | - | case 11: |
82 | + | ChatHandler(player->GetSession()).PSendSysMessage("Name: %s, With Total Kills : %u", name.c_str(), totalKills); |
83 | - | player->PlayerTalkClass->SendCloseGossip(); |
83 | + | } |
84 | - | break; |
84 | + | while(result->NextRow()); |
85 | - | |
85 | + | } |
86 | - | case 0: |
86 | + | OnGossipHello(player, creature); // return to main menu |
87 | - | player->GetSession()->SendNotification(Notification); |
87 | + | return true; |
88 | - | ChatHandler(player->GetSession()).PSendSysMessage(M_Whisper); |
88 | + | } |
89 | - | player->PlayerTalkClass->SendGossipMenu(12, creature->GetGUID()); |
89 | + | }; |
90 | - | break; |
90 | + | |
91 | - | |
91 | + | |
92 | - | case 1: //Warrior |
92 | + | |
93 | - | { |
93 | + | |
94 | - | QueryResult result = CharacterDatabase.Query("SELECT name,totalKills FROM characters WHERE class='1' ORDER BY totalKills DESC LIMIT 5"); |
94 | + | |
95 | - | if(!result) |
95 | + |