Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- <--------------------------------------------------------------------------->
- - Developer: Valtorei
- - Complete: 100%
- - Scriptname: "Title NPC"
- - Revision: 0.0.1
- - Created: 05/05/2014
- <--------------------------------------------------------------------------->
- */
- #include "ScriptPCH.h"
- enum eRanks
- {
- /* Alliance */
- PRIVATE = 1,
- CORPORAL = 2,
- SERGEANT = 3,
- MASTER_SERGEANT = 4,
- SERGEANT_MAJOR = 5,
- KNIGHT = 6,
- KNIGHT_LIEUTENANT = 7,
- KNIGHT_CAPTAIN = 8,
- KNIGHT_CHAMPION = 9,
- LIEUTENANT_COMMANDER = 10,
- COMMANDER = 11,
- MARSHAL = 12,
- FIELD_MARSHAL = 13,
- GRAND_MARSHAL = 14,
- OF_THE_ALLIANCE = 126,
- /* Horde */
- SCOUT = 15,
- GRUNT = 16,
- SERGEANT_H = 17,
- SENIOR_SERGEANT = 18,
- FIRST_SERGEANT = 19,
- STONE_GUARD = 20,
- BLOOD_GUARD = 21,
- LEGIONNAIRE = 22,
- CENTURION = 23,
- CHAMPION = 24,
- LIEUTENANT_GENERAL = 25,
- GENERAL = 26,
- WARLORD = 27,
- HIGH_WARLORD = 28,
- OF_THE_HORDE = 127
- };
- enum eKills
- {
- KILLS_1 = 100,
- KILLS_2 = 500,
- KILLS_3 = 1000,
- KILLS_4 = 2000,
- KILLS_5 = 4000,
- KILLS_6 = 5000,
- KILLS_7 = 6000,
- KILLS_8 = 8000,
- KILLS_9 = 10000,
- KILLS_10 = 15000,
- KILLS_11 = 25000,
- KILLS_12 = 40000,
- KILLS_13 = 45000,
- KILLS_14 = 50000,
- KILLS_15 = 75000
- };
- class TitleNpc : public CreatureScript
- {
- public:
- TitleNpc() : CreatureScript("TitleNpc"){}
- uint32 GetTotalKill(Player* player)
- {
- QueryResult result = CharacterDatabase.PQuery("SELECT totalKills FROM characters WHERE guid = %u", player->GetGUID());
- if (result)
- {
- Field* field = result->Fetch();
- if (field)
- return field[0].GetUInt32();
- }
- return NULL;
- }
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (player->GetTeam() == ALLIANCE)
- {
- player->PlayerTalkClass->ClearMenus();
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_01:30|t Private", GOSSIP_SENDER_MAIN, PRIVATE);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_02:30|t Corporal", GOSSIP_SENDER_MAIN, CORPORAL);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_03:30|t Sergeant", GOSSIP_SENDER_MAIN, SERGEANT);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_04:30|t Master Sergeant", GOSSIP_SENDER_MAIN, MASTER_SERGEANT);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_05:30|t Sergeant Major", GOSSIP_SENDER_MAIN, SERGEANT_MAJOR);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_06:30|t Knight", GOSSIP_SENDER_MAIN, KNIGHT);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_07:30|t Knight Lieutenant", GOSSIP_SENDER_MAIN, KNIGHT_LIEUTENANT);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_08:30|t Knight Captain", GOSSIP_SENDER_MAIN, KNIGHT_CAPTAIN);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_09:30|t Knight Champion", GOSSIP_SENDER_MAIN, KNIGHT_CHAMPION);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_11:30|t Lieutenant Commander", GOSSIP_SENDER_MAIN, LIEUTENANT_COMMANDER);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_12:30|t Commander.", GOSSIP_SENDER_MAIN, COMMANDER);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_13:30|t Marshal", GOSSIP_SENDER_MAIN, MARSHAL);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_14:30|t Field Marshal", GOSSIP_SENDER_MAIN, FIELD_MARSHAL);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_15:30|t Grand Marshal", GOSSIP_SENDER_MAIN, GRAND_MARSHAL);
- return true;
- }
- else
- {
- player->PlayerTalkClass->ClearMenus();
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_01:30|t Scout", GOSSIP_SENDER_MAIN, SCOUT);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_02:30|t Grunt", GOSSIP_SENDER_MAIN, GRUNT);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_03:30|t Sergeant", GOSSIP_SENDER_MAIN, SERGEANT_H);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_04:30|t Senior Sergeant", GOSSIP_SENDER_MAIN, SENIOR_SERGEANT);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_05:30|t First Sergeant", GOSSIP_SENDER_MAIN, FIRST_SERGEANT);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_06:30|t Stone Guard", GOSSIP_SENDER_MAIN, STONE_GUARD);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_07:30|t Blood Guard", GOSSIP_SENDER_MAIN, BLOOD_GUARD);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_08:30|t Legionnaire", GOSSIP_SENDER_MAIN, LEGIONNAIRE);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_09:30|t Centurion", GOSSIP_SENDER_MAIN,CENTURION);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_11:30|t Champion", GOSSIP_SENDER_MAIN, CHAMPION);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_12:30|t Lieutenant General", GOSSIP_SENDER_MAIN, LIEUTENANT_GENERAL);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_13:30|t General", GOSSIP_SENDER_MAIN, GENERAL);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_14:30|t Warlord", GOSSIP_SENDER_MAIN, WARLORD);
- player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_15:30|t High Warlord", GOSSIP_SENDER_MAIN, HIGH_WARLORD);
- return true;
- }
- }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction)
- {
- player->PlayerTalkClass->ClearMenus();
- switch(uiAction)
- {
- case PRIVATE:
- {
- if (GetTotalKill(Player) >= KILLS_1)
- player->SetTitle(sCharTitlesStore.LookupEntry(1));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case CORPORAL:
- {
- if (GetTotalKill(Player) >= KILLS_2)
- player->SetTitle(sCharTitlesStore.LookupEntry(2));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case SERGEANT:
- {
- if (GetTotalKill(Player) >= KILLS_3)
- player->SetTitle(sCharTitlesStore.LookupEntry(3));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case MASTER_SERGEANT:
- {
- if (GetTotalKill(Player) >= KILLS_4)
- player->SetTitle(sCharTitlesStore.LookupEntry(4));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case SERGEANT_MAJOR:
- {
- if (GetTotalKill(Player) >= KILLS_5)
- player->SetTitle(sCharTitlesStore.LookupEntry(5));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case KNIGHT:
- {
- if (GetTotalKill(Player) >= KILLS_6)
- player->SetTitle(sCharTitlesStore.LookupEntry(6));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case KNIGHT_LIEUTENANT:
- {
- if (GetTotalKill(Player) >= KILLS_7)
- player->SetTitle(sCharTitlesStore.LookupEntry(7));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case KNIGHT_CAPTAIN:
- {
- if (GetTotalKill(Player) >= KILLS_8)
- player->SetTitle(sCharTitlesStore.LookupEntry(8));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case KNIGHT_CHAMPION:
- {
- if (GetTotalKill(Player) >= KILLS_9)
- player->SetTitle(sCharTitlesStore.LookupEntry(9));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case LIEUTENANT_COMMANDER:
- {
- if (GetTotalKill(Player) >= KILLS_10)
- player->SetTitle(sCharTitlesStore.LookupEntry(10));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case COMMANDER:
- {
- if (GetTotalKill(Player) >= KILLS_11)
- player->SetTitle(sCharTitlesStore.LookupEntry(11));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case MARSHAL:
- {
- if (GetTotalKill(Player) >= KILLS_12)
- player->SetTitle(sCharTitlesStore.LookupEntry(12));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case FIELD_MARSHAL:
- {
- if (GetTotalKill(Player) >= KILLS_13)
- player->SetTitle(sCharTitlesStore.LookupEntry(13));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case GRAND_MARSHAL:
- {
- if (GetTotalKill(Player) >= KILLS_14)
- player->SetTitle(sCharTitlesStore.LookupEntry(14));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case SCOUT:
- {
- if (GetTotalKill(Player) >= KILLS_1)
- player->SetTitle(sCharTitlesStore.LookupEntry(15));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case GRUNT:
- {
- if (GetTotalKill(Player) >= KILLS_2)
- player->SetTitle(sCharTitlesStore.LookupEntry(16));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case SERGEANT_H:
- {
- if (GetTotalKill(Player) >= KILLS_3)
- Player->SetTitle(sCharTitlesStore.LookupEntry(17));
- else
- Player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case SENIOR_SERGEANT:
- {
- if (GetTotalKill(Player) >= KILLS_4)
- player->SetTitle(sCharTitlesStore.LookupEntry(18));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case FIRST_SERGEANT:
- {
- if (GetTotalKill(Player) >= KILLS_5)
- player->SetTitle(sCharTitlesStore.LookupEntry(19));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case STONE_GUARD:
- {
- if (GetTotalKill(Player) >= KILLS_6)
- player->SetTitle(sCharTitlesStore.LookupEntry(20));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case BLOOD_GUARD:
- {
- if (GetTotalKill(Player) >= KILLS_7)
- player->SetTitle(sCharTitlesStore.LookupEntry(21));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case LEGIONNAIRE:
- {
- if (GetTotalKill(Player) >= KILLS_8)
- player->SetTitle(sCharTitlesStore.LookupEntry(22));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case CENTURION:
- {
- if (GetTotalKill(Player) >= KILLS_9)
- player->SetTitle(sCharTitlesStore.LookupEntry(23));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case CHAMPION:
- {
- if (GetTotalKill(Player) >= KILLS_10)
- player->SetTitle(sCharTitlesStore.LookupEntry(24));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case LIEUTENANT_GENERAL:
- {
- if (GetTotalKill(Player) >= KILLS_11)
- player->SetTitle(sCharTitlesStore.LookupEntry(25));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case GENERAL:
- {
- if (GetTotalKill(Player) >= KILLS_12)
- player->SetTitle(sCharTitlesStore.LookupEntry(26));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case WARLORD:
- {
- if (GetTotalKill(Player) >= KILLS_13)
- player->SetTitle(sCharTitlesStore.LookupEntry(27));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- case HIGH_WARLORD:
- {
- if (GetTotalKill(Player) >= KILLS_14)
- player->SetTitle(sCharTitlesStore.LookupEntry(28));
- else
- player->GetSession()->SendNotification("You dont have enough kills");
- }
- break;
- }
- return true;
- }
- };
- void AddSC_TitleNpc()
- {
- new TitleNpc();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement