SHOW:
|
|
- or go back to the newest paste.
1 | - | /* |
1 | + | |
2 | - | AYE |
2 | + | |
3 | - | |
3 | + | |
4 | - | Tommy |
4 | + | |
5 | - | */ |
5 | + | |
6 | }; | |
7 | ||
8 | // {icon, "title name", honored_kills, titleID} | |
9 | - | uint32 menu_id; |
9 | + | |
10 | { | |
11 | {9, "Private", 1, 1 }, | |
12 | {9, "Corporal", 100, 2 }, | |
13 | {9, "Sergeant", 250, 3 }, | |
14 | {9, "Master Sergeant", 500, 4 }, | |
15 | {9, "Sergeant Major", 750, 5 }, | |
16 | {9, "Knight", 1000, 6 }, | |
17 | {9, "Knight-Lieutenant", 1500, 7 }, | |
18 | - | {1, 9, "Private", 1, 1 }, |
18 | + | {9, "Knight-Captain", 2000, 8 }, |
19 | - | {2, 9, "Corporal", 100, 2 }, |
19 | + | {9, "Knight-Champion", 2500, 9 }, |
20 | - | {3, 9, "Sergeant", 250, 3 }, |
20 | + | {9, "Lieutenant Commander", 3000, 10 }, |
21 | - | {4, 9, "Master Sergeant", 500, 4 }, |
21 | + | {9, "Commander", 3500, 11 }, |
22 | - | {5, 9, "Sergeant Major", 750, 5 }, |
22 | + | {9, "Marshal", 4000, 12 }, |
23 | - | {6, 9, "Knight", 1000, 6 }, |
23 | + | {9, "Field Marshal", 4500, 13 }, |
24 | - | {7, 9, "Knight-Lieutenant", 1500, 7 }, |
24 | + | {9, "Grand Marshal", 5000, 14 }, |
25 | - | {8, 9, "Knight-Captain", 2000, 8 }, |
25 | + | |
26 | - | {9, 9, "Knight-Champion", 2500, 9 }, |
26 | + | {9, "Scout", 1, 15 }, |
27 | - | {10, 9, "Lieutenant Commander", 3000, 10 }, |
27 | + | {9, "Grunt", 100, 16 }, |
28 | - | {11, 9, "Commander", 3500, 11 }, |
28 | + | {9, "Sergeant", 250, 17 }, |
29 | - | {12, 9, "Marshal", 4000, 12 }, |
29 | + | {9, "Senior Sergeant", 500, 18 }, |
30 | - | {13, 9, "Field Marshal", 4500, 13 }, |
30 | + | {9, "First Sergeant", 750, 19 }, |
31 | - | {14, 9, "Grand Marshal", 5000, 14 }, |
31 | + | {9, "Stone Guard", 1000, 20 }, |
32 | {9, "Blood Guard", 1500, 21 }, | |
33 | - | {15, 9, "Scout", 1, 15 }, |
33 | + | {9, "Legionnaire", 2000, 22 }, |
34 | - | {16, 9, "Grunt", 100, 16 }, |
34 | + | {9, "Centurion", 2500, 23 }, |
35 | - | {17, 9, "Sergeant", 250, 17 }, |
35 | + | {9, "Champion", 3000, 24 }, |
36 | - | {18, 9, "Senior Sergeant", 500, 18 }, |
36 | + | {9, "Lieutenant General", 3500, 25 }, |
37 | - | {19, 9, "First Sergeant", 750, 19 }, |
37 | + | {9, "General", 4000, 26 }, |
38 | - | {20, 9, "Stone Guard", 1000, 20 }, |
38 | + | {9, "Warlord", 4500, 27 }, |
39 | - | {21, 9, "Blood Guard", 1500, 21 }, |
39 | + | {9, "High Warlord", 5000, 28 }, |
40 | - | {22, 9, "Legionnaire", 2000, 22 }, |
40 | + | |
41 | - | {23, 9, "Centurion", 2500, 23 }, |
41 | + | static const uint32 TITLES_SIZE = (sizeof(Titles) / sizeof(*Titles)); // NOTE, this was wrong. it was uint32 instead of *Titles or HonorGossip in the sizeof. |
42 | - | {24, 9, "Champion", 3000, 24 }, |
42 | + | |
43 | - | {25, 9, "Lieutenant General", 3500, 25 }, |
43 | + | |
44 | - | {26, 9, "General", 4000, 26 }, |
44 | + | |
45 | - | {27, 9, "Warlord", 4500, 27 }, |
45 | + | |
46 | - | {28, 9, "High Warlord", 5000, 28 }, |
46 | + | |
47 | ||
48 | bool OnGossipHello(Player* player, Creature* creature) | |
49 | { | |
50 | player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\INV_Misc_QuestionMark:30|tHow does this npc work?|r", GOSSIP_SENDER_MAIN, 100); | |
51 | player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_15:30|tHonorable Kills Titles|r", GOSSIP_SENDER_MAIN, 101); | |
52 | player->ADD_GOSSIP_ITEM(7, "|TInterface\\icons\\Ability_Spy:30|tNevermind|r", GOSSIP_SENDER_MAIN, 102); | |
53 | player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); | |
54 | return true; | |
55 | } | |
56 | - | player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\INV_Misc_QuestionMark:30|tHow does this npc work?|r", GOSSIP_SENDER_MAIN, 100); |
56 | + | |
57 | - | player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_15:30|tHonorable Kills Titles|r", GOSSIP_SENDER_MAIN, 101); |
57 | + | |
58 | - | player->ADD_GOSSIP_ITEM(7, "|TInterface\\icons\\Ability_Spy:30|tNevermind|r", GOSSIP_SENDER_MAIN, 102); |
58 | + | |
59 | - | player->SEND_GOSSIP_MENU(1, creature->GetGUID()); |
59 | + | |
60 | if (actions == 100) | |
61 | { | |
62 | ChatHandler(player->GetSession()).SendSysMessage("|cffff6060[Information]:|r This npc show you 2 different options,Honorable Kills Titles costed on LifeTime Kills,Devium WoW Titles show you our own titles |cffff0000[Patch Required]|r,and costed on [Devium Title Token]."); | |
63 | OnGossipHello(player, creature); | |
64 | } | |
65 | else if(actions == 101) | |
66 | { | |
67 | if (player->GetTeamId() == ALLIANCE) | |
68 | - | return false; |
68 | + | for (int i = 0; i < TITLES_SIZE/2; ++i) |
69 | - | } |
69 | + | player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, i); |
70 | else | |
71 | for (int i = TITLES_SIZE/2; i < TITLES_SIZE; ++i) | |
72 | - | if (player->GetTeam() == ALLIANCE) |
72 | + | player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, i); |
73 | - | for (int i = 0; i < 14; i++) |
73 | + | player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "<- Back", GOSSIP_SENDER_MAIN, 999); |
74 | - | player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, Titles[i].menu_id); |
74 | + | player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); |
75 | } | |
76 | - | for (int i = 14; i < 28; i++) |
76 | + | |
77 | - | player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, Titles[i].menu_id); |
77 | + | |
78 | - | player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "<- Back", GOSSIP_SENDER_MAIN, 999); |
78 | + | else if (actions == 999) // NOTE main menu, no need to write the options twice, use the function like this. |
79 | - | player->SEND_GOSSIP_MENU(1, creature->GetGUID()); |
79 | + | OnGossipHello(player, creature); |
80 | else if (actions < TITLES_SIZE) // must check so we wont accidently go overboard | |
81 | { | |
82 | if (player->HasTitle(Titles[actions].titleID)) | |
83 | player->GetSession()->SendNotification("You already have this title!"); | |
84 | - | else if (actions == 999) |
84 | + | else if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) < Titles[actions].HK) |
85 | player->GetSession()->SendNotification("You don't have enough kills!"); | |
86 | - | player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\INV_Misc_QuestionMark:30|tHow does this npc work?|r", GOSSIP_SENDER_MAIN, 100); |
86 | + | else if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(Titles[actions].titleID)) |
87 | - | player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_15:30|tHonorable Kills Titles|r", GOSSIP_SENDER_MAIN, 101); |
87 | + | |
88 | - | player->ADD_GOSSIP_ITEM(7, "|TInterface\\icons\\Ability_Spy:30|tNevermind|r", GOSSIP_SENDER_MAIN, 102); |
88 | + | player->SetTitle(titleEntry); |
89 | - | player->SEND_GOSSIP_MENU(1, creature->GetGUID()); |
89 | + | player->GetSession()->SendAreaTriggerMessage("Title granted!"); |
90 | } | |
91 | OnGossipHello(player, creature); | |
92 | - | for (int i = 0; i < sizeof(Titles) / sizeof(uint32); i++) |
92 | + | |
93 | return true; // NOTE always return true, unless you want to send the default gossip menu from DB | |
94 | - | if (actions == Titles[i].menu_id) |
94 | + | |
95 | }; | |
96 | - | if (player->HasTitle(Titles[i].titleID)) |
96 | + | |
97 | - | { |
97 | + | |
98 | - | player->GetSession()->SendNotification("You already have this title!"); |
98 | + | |
99 | - | return false; |
99 | + | |
100 | - | } |
100 | + |