Advertisement
Valtorei

Title NPC

May 9th, 2014
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 12.36 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3.    - Developer: Valtorei
  4.    - Complete: 100%
  5.    - Scriptname: "Title NPC"
  6.    - Revision: 0.0.1
  7.    - Created: 05/05/2014
  8. <--------------------------------------------------------------------------->
  9. */
  10.  
  11. #include "ScriptPCH.h"
  12.  
  13.  
  14. enum eRanks
  15. {
  16.       /* Alliance */
  17.     PRIVATE = 1,
  18.     CORPORAL = 2,
  19.     SERGEANT = 3,
  20.     MASTER_SERGEANT = 4,
  21.     SERGEANT_MAJOR = 5,
  22.     KNIGHT = 6,
  23.     KNIGHT_LIEUTENANT = 7,
  24.     KNIGHT_CAPTAIN = 8,
  25.     KNIGHT_CHAMPION = 9,
  26.     LIEUTENANT_COMMANDER = 10,
  27.     COMMANDER = 11,
  28.     MARSHAL = 12,
  29.     FIELD_MARSHAL = 13,
  30.     GRAND_MARSHAL = 14,
  31.     OF_THE_ALLIANCE = 126,
  32.   /* Horde */
  33.     SCOUT = 15,
  34.     GRUNT = 16,
  35.     SERGEANT_H = 17,
  36.     SENIOR_SERGEANT = 18,
  37.     FIRST_SERGEANT = 19,
  38.     STONE_GUARD = 20,
  39.     BLOOD_GUARD = 21,
  40.     LEGIONNAIRE = 22,
  41.     CENTURION = 23,
  42.     CHAMPION = 24,
  43.     LIEUTENANT_GENERAL = 25,
  44.     GENERAL = 26,
  45.     WARLORD = 27,
  46.     HIGH_WARLORD = 28,
  47.     OF_THE_HORDE = 127
  48. };
  49.  
  50. enum eKills
  51. {
  52.     KILLS_1 = 100,
  53.     KILLS_2 = 500,
  54.     KILLS_3 = 1000,
  55.     KILLS_4 = 2000,
  56.     KILLS_5 = 4000,
  57.     KILLS_6 = 5000,
  58.     KILLS_7 = 6000,
  59.     KILLS_8 = 8000,
  60.     KILLS_9 = 10000,
  61.     KILLS_10 = 15000,
  62.     KILLS_11 = 25000,
  63.     KILLS_12 = 40000,
  64.     KILLS_13 = 45000,
  65.     KILLS_14 = 50000,
  66.     KILLS_15 = 75000
  67. };
  68.  
  69. class TitleNpc : public CreatureScript
  70. {
  71.     public:
  72.         TitleNpc() : CreatureScript("TitleNpc"){}
  73.  
  74.         uint32 GetTotalKill(Player* player)
  75.         {
  76.             QueryResult result = CharacterDatabase.PQuery("SELECT totalKills FROM characters WHERE guid = %u", player->GetGUID());
  77.             if (result)
  78.             {
  79.                 Field* field = result->Fetch();
  80.                 if (field)
  81.                     return field[0].GetUInt32();
  82.             }
  83.                 return NULL;
  84.         }
  85.        
  86.         bool OnGossipHello(Player* player, Creature* creature)
  87.         {
  88.             if (player->GetTeam() == ALLIANCE)
  89.             {
  90.                 player->PlayerTalkClass->ClearMenus();
  91.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_01:30|t Private", GOSSIP_SENDER_MAIN, PRIVATE);
  92.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_02:30|t Corporal", GOSSIP_SENDER_MAIN, CORPORAL);
  93.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_03:30|t Sergeant", GOSSIP_SENDER_MAIN, SERGEANT);
  94.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_04:30|t Master Sergeant", GOSSIP_SENDER_MAIN, MASTER_SERGEANT);
  95.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_05:30|t Sergeant Major", GOSSIP_SENDER_MAIN, SERGEANT_MAJOR);
  96.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_06:30|t Knight", GOSSIP_SENDER_MAIN, KNIGHT);
  97.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_07:30|t Knight Lieutenant", GOSSIP_SENDER_MAIN, KNIGHT_LIEUTENANT);
  98.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_08:30|t Knight Captain", GOSSIP_SENDER_MAIN, KNIGHT_CAPTAIN);
  99.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_09:30|t Knight Champion", GOSSIP_SENDER_MAIN, KNIGHT_CHAMPION);
  100.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_11:30|t Lieutenant Commander", GOSSIP_SENDER_MAIN, LIEUTENANT_COMMANDER);
  101.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_12:30|t Commander.", GOSSIP_SENDER_MAIN, COMMANDER);
  102.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_13:30|t Marshal", GOSSIP_SENDER_MAIN, MARSHAL);
  103.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_14:30|t Field Marshal", GOSSIP_SENDER_MAIN, FIELD_MARSHAL);
  104.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_A_15:30|t Grand Marshal", GOSSIP_SENDER_MAIN, GRAND_MARSHAL);
  105.                
  106.                 return true;
  107.             }
  108.            
  109.             else
  110.             {
  111.                 player->PlayerTalkClass->ClearMenus();
  112.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_01:30|t Scout", GOSSIP_SENDER_MAIN, SCOUT);
  113.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_02:30|t Grunt", GOSSIP_SENDER_MAIN, GRUNT);
  114.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_03:30|t Sergeant", GOSSIP_SENDER_MAIN, SERGEANT_H);
  115.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_04:30|t Senior Sergeant", GOSSIP_SENDER_MAIN, SENIOR_SERGEANT);
  116.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_05:30|t First Sergeant", GOSSIP_SENDER_MAIN, FIRST_SERGEANT);
  117.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_06:30|t Stone Guard", GOSSIP_SENDER_MAIN, STONE_GUARD);
  118.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_07:30|t Blood Guard", GOSSIP_SENDER_MAIN, BLOOD_GUARD);
  119.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_08:30|t Legionnaire", GOSSIP_SENDER_MAIN, LEGIONNAIRE);
  120.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_09:30|t Centurion", GOSSIP_SENDER_MAIN,CENTURION);
  121.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_11:30|t Champion", GOSSIP_SENDER_MAIN, CHAMPION);
  122.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_12:30|t Lieutenant General", GOSSIP_SENDER_MAIN, LIEUTENANT_GENERAL);
  123.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_13:30|t General", GOSSIP_SENDER_MAIN, GENERAL);
  124.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_14:30|t Warlord", GOSSIP_SENDER_MAIN, WARLORD);
  125.                 player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_15:30|t High Warlord", GOSSIP_SENDER_MAIN, HIGH_WARLORD);
  126.                
  127.                 return true;
  128.             }
  129.         }
  130.        
  131.         bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction)
  132.         {
  133.             player->PlayerTalkClass->ClearMenus();
  134.            
  135.             switch(uiAction)
  136.             {
  137.                 case PRIVATE:
  138.                 {
  139.                     if (GetTotalKill(Player) >= KILLS_1)
  140.                         player->SetTitle(sCharTitlesStore.LookupEntry(1));
  141.                     else
  142.                         player->GetSession()->SendNotification("You dont have enough kills");
  143.                 }
  144.                 break;
  145.  
  146.                 case CORPORAL:
  147.                 {
  148.                     if (GetTotalKill(Player) >= KILLS_2)
  149.                         player->SetTitle(sCharTitlesStore.LookupEntry(2));
  150.                     else
  151.                         player->GetSession()->SendNotification("You dont have enough kills");
  152.                 }
  153.                 break;
  154.                
  155.                 case SERGEANT:
  156.                 {
  157.                     if (GetTotalKill(Player) >= KILLS_3)
  158.                         player->SetTitle(sCharTitlesStore.LookupEntry(3));
  159.                     else
  160.                         player->GetSession()->SendNotification("You dont have enough kills");
  161.                 }
  162.                 break;
  163.                
  164.                 case MASTER_SERGEANT:
  165.                 {
  166.                     if (GetTotalKill(Player) >= KILLS_4)
  167.                         player->SetTitle(sCharTitlesStore.LookupEntry(4));
  168.                     else
  169.                         player->GetSession()->SendNotification("You dont have enough kills");
  170.                 }
  171.                 break;
  172.                
  173.                 case SERGEANT_MAJOR:
  174.                 {
  175.                     if (GetTotalKill(Player) >= KILLS_5)
  176.                         player->SetTitle(sCharTitlesStore.LookupEntry(5));
  177.                     else
  178.                         player->GetSession()->SendNotification("You dont have enough kills");
  179.                 }
  180.                 break;
  181.                
  182.                 case KNIGHT:
  183.                 {
  184.                     if (GetTotalKill(Player) >= KILLS_6)
  185.                         player->SetTitle(sCharTitlesStore.LookupEntry(6));
  186.                     else
  187.                         player->GetSession()->SendNotification("You dont have enough kills");
  188.                 }
  189.                 break;
  190.                
  191.                 case KNIGHT_LIEUTENANT:
  192.                 {
  193.                     if (GetTotalKill(Player) >= KILLS_7)
  194.                         player->SetTitle(sCharTitlesStore.LookupEntry(7));
  195.                     else
  196.                         player->GetSession()->SendNotification("You dont have enough kills");
  197.                 }
  198.                 break;
  199.                
  200.                 case KNIGHT_CAPTAIN:
  201.                 {
  202.                     if (GetTotalKill(Player) >= KILLS_8)
  203.                         player->SetTitle(sCharTitlesStore.LookupEntry(8));
  204.                     else
  205.                         player->GetSession()->SendNotification("You dont have enough kills");
  206.                 }
  207.                 break;
  208.                
  209.                 case KNIGHT_CHAMPION:
  210.                 {
  211.                     if (GetTotalKill(Player) >= KILLS_9)
  212.                         player->SetTitle(sCharTitlesStore.LookupEntry(9));
  213.                     else
  214.                         player->GetSession()->SendNotification("You dont have enough kills");
  215.                 }
  216.                 break;
  217.                
  218.                 case LIEUTENANT_COMMANDER:
  219.                 {
  220.                     if (GetTotalKill(Player) >= KILLS_10)
  221.                         player->SetTitle(sCharTitlesStore.LookupEntry(10));
  222.                     else
  223.                         player->GetSession()->SendNotification("You dont have enough kills");
  224.                 }
  225.                 break;
  226.                
  227.                 case COMMANDER:
  228.                 {
  229.                     if (GetTotalKill(Player) >= KILLS_11)
  230.                         player->SetTitle(sCharTitlesStore.LookupEntry(11));
  231.                     else
  232.                         player->GetSession()->SendNotification("You dont have enough kills");
  233.                 }
  234.                 break;
  235.                
  236.                 case MARSHAL:
  237.                 {
  238.                     if (GetTotalKill(Player) >= KILLS_12)
  239.                         player->SetTitle(sCharTitlesStore.LookupEntry(12));
  240.                     else
  241.                         player->GetSession()->SendNotification("You dont have enough kills");
  242.                 }
  243.                 break;
  244.                
  245.                 case FIELD_MARSHAL:
  246.                 {
  247.                     if (GetTotalKill(Player) >= KILLS_13)
  248.                         player->SetTitle(sCharTitlesStore.LookupEntry(13));
  249.                     else
  250.                         player->GetSession()->SendNotification("You dont have enough kills");
  251.                 }
  252.                 break;
  253.                
  254.                 case GRAND_MARSHAL:
  255.                 {
  256.                     if (GetTotalKill(Player) >= KILLS_14)
  257.                         player->SetTitle(sCharTitlesStore.LookupEntry(14));
  258.                     else
  259.                         player->GetSession()->SendNotification("You dont have enough kills");
  260.                 }
  261.                 break;
  262.                
  263.                 case SCOUT:
  264.                 {
  265.                     if (GetTotalKill(Player) >= KILLS_1)
  266.                         player->SetTitle(sCharTitlesStore.LookupEntry(15));
  267.                     else
  268.                         player->GetSession()->SendNotification("You dont have enough kills");
  269.                 }
  270.                 break;
  271.                
  272.                 case GRUNT:
  273.                 {
  274.                     if (GetTotalKill(Player) >= KILLS_2)
  275.                         player->SetTitle(sCharTitlesStore.LookupEntry(16));
  276.                     else
  277.                         player->GetSession()->SendNotification("You dont have enough kills");
  278.                 }
  279.                 break;
  280.                
  281.                 case SERGEANT_H:
  282.                 {
  283.                     if (GetTotalKill(Player) >= KILLS_3)
  284.                         Player->SetTitle(sCharTitlesStore.LookupEntry(17));
  285.                     else
  286.                         Player->GetSession()->SendNotification("You dont have enough kills");
  287.                 }
  288.                 break;
  289.                
  290.                 case SENIOR_SERGEANT:
  291.                 {
  292.                     if (GetTotalKill(Player) >= KILLS_4)
  293.                         player->SetTitle(sCharTitlesStore.LookupEntry(18));
  294.                     else
  295.                         player->GetSession()->SendNotification("You dont have enough kills");
  296.                 }
  297.                 break;
  298.                
  299.                 case FIRST_SERGEANT:
  300.                 {
  301.                     if (GetTotalKill(Player) >= KILLS_5)
  302.                         player->SetTitle(sCharTitlesStore.LookupEntry(19));
  303.                     else
  304.                         player->GetSession()->SendNotification("You dont have enough kills");
  305.                 }
  306.                 break;
  307.                
  308.                 case STONE_GUARD:
  309.                 {
  310.                     if (GetTotalKill(Player) >= KILLS_6)
  311.                         player->SetTitle(sCharTitlesStore.LookupEntry(20));
  312.                     else
  313.                         player->GetSession()->SendNotification("You dont have enough kills");
  314.                 }
  315.                 break;
  316.                
  317.                 case BLOOD_GUARD:
  318.                 {
  319.                     if (GetTotalKill(Player) >= KILLS_7)
  320.                         player->SetTitle(sCharTitlesStore.LookupEntry(21));
  321.                     else
  322.                         player->GetSession()->SendNotification("You dont have enough kills");
  323.                 }
  324.                 break;
  325.                
  326.                 case LEGIONNAIRE:
  327.                 {
  328.                     if (GetTotalKill(Player) >= KILLS_8)
  329.                         player->SetTitle(sCharTitlesStore.LookupEntry(22));
  330.                     else
  331.                         player->GetSession()->SendNotification("You dont have enough kills");
  332.                 }
  333.                 break;
  334.                
  335.                 case CENTURION:
  336.                 {
  337.                     if (GetTotalKill(Player) >= KILLS_9)
  338.                         player->SetTitle(sCharTitlesStore.LookupEntry(23));
  339.                     else
  340.                         player->GetSession()->SendNotification("You dont have enough kills");
  341.                 }
  342.                 break;
  343.                
  344.                 case CHAMPION:
  345.                 {
  346.                     if (GetTotalKill(Player) >= KILLS_10)
  347.                         player->SetTitle(sCharTitlesStore.LookupEntry(24));
  348.                     else
  349.                         player->GetSession()->SendNotification("You dont have enough kills");
  350.                 }
  351.                 break;
  352.                
  353.                 case LIEUTENANT_GENERAL:
  354.                 {
  355.                     if (GetTotalKill(Player) >= KILLS_11)
  356.                         player->SetTitle(sCharTitlesStore.LookupEntry(25));
  357.                     else
  358.                         player->GetSession()->SendNotification("You dont have enough kills");
  359.                 }
  360.                 break;
  361.                
  362.                 case GENERAL:
  363.                 {
  364.                     if (GetTotalKill(Player) >= KILLS_12)
  365.                         player->SetTitle(sCharTitlesStore.LookupEntry(26));
  366.                     else
  367.                         player->GetSession()->SendNotification("You dont have enough kills");
  368.                 }
  369.                 break;
  370.                
  371.                 case WARLORD:
  372.                 {
  373.                     if (GetTotalKill(Player) >= KILLS_13)
  374.                         player->SetTitle(sCharTitlesStore.LookupEntry(27));
  375.                     else
  376.                         player->GetSession()->SendNotification("You dont have enough kills");
  377.                 }
  378.                 break;
  379.                
  380.                 case HIGH_WARLORD:
  381.                 {
  382.                     if (GetTotalKill(Player) >= KILLS_14)
  383.                         player->SetTitle(sCharTitlesStore.LookupEntry(28));
  384.                     else
  385.                         player->GetSession()->SendNotification("You dont have enough kills");
  386.                 }
  387.                 break;
  388.             }
  389.            
  390.             return true;
  391.         }
  392. };
  393.        
  394. void AddSC_TitleNpc()
  395. {
  396.     new TitleNpc();
  397. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement