Advertisement
randy336

[Trinity] Title System

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