Advertisement
cgm2k7

npc_auto_equipe.h

Oct 15th, 2014
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 23.78 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include "Config.h"
  3. #include "Scritp_auto_equipe.h"
  4.  
  5. bool Relogar = true;
  6. bool AUTO_EQUIPADOR = true;
  7. bool AUTO_TALENTOS = true;
  8. int TIPO_DE_TRENADOR_ORIGINAL;
  9.  
  10. int Arena_Season; //8 = Arena Season 8 //7 = Arena Season 7  //6 = Arena Season 6  //5 = Arena Season 5  //e etc..
  11. std::string Arena_Season_Name;
  12.  
  13. enum ItemsMENU
  14. {
  15.     MENU_SAIR = 99901,
  16.     MENU_VOLTAR = 99902,
  17.     REMOVER_EQUIP = 99903,
  18.     DUAL_TELENTS = 99904,
  19.     RESTAR_LEVEL80 = 99905,
  20.     GLYPH_NPC_MENU = 99906,
  21.     RESET_TALENTOS = 99907,
  22.     AUTO_TALENTOS_MENU = 99908,
  23.     TRENADOR_CLASS = 80,
  24.     EQUIPAR_ITEM_AUTOMATICOS = 90,
  25.     MENUTRENADOR = 99912,
  26.     TRENADORCLASS = 99916,
  27.     MENU_TRENADOR_ORIGINAL = 99913,
  28.     MENU_TRENADOR_SPELLSUMMON = 99914,
  29.     MENU_EQUIPAR_ITEM_AUTOMATICOS = 99915,
  30.     MENU_WARRIOR,
  31.     MENU_PALADIN,
  32.     MENU_HUNTER,
  33.     MENU_ROGUE,
  34.     MENU_PRIEST,
  35.     MENU_DEATH_K,
  36.     MENU_SHAMAN,
  37.     MENU_MAGE,
  38.     MENU_WARLOCK,
  39.     MENU_DRUID,
  40.  
  41.     SPELL_TELEPORT_VISUAL = 64446
  42. };
  43. struct TabelaItens
  44. {
  45.     uint32 itemID;
  46.     uint32  pClass;
  47.     uint8 ItemSet, PTalentoTipo;
  48.    
  49. };
  50. std::vector<TabelaItens> TabelaItensList;
  51. bool CarregarAutoEquipeItens()
  52. {
  53.     TabelaItensList.clear();
  54.  
  55.     TC_LOG_INFO("server.loading", "Carregando Itens para AutoEquipe...");
  56.     uint32 sMSTime = getMSTime();
  57.  
  58.     QueryResult resultados = CharacterDatabase.PQuery("SELECT ItemID, pClass, ItemSet, pTalentoTipo FROM `item_autoEquipe`");
  59.     if (!resultados)
  60.         return true;
  61.     uint16 contador = 0;
  62.     do
  63.     {
  64.         Field* fields = resultados->Fetch();
  65.         TabelaItens Itens;
  66.         Itens.itemID = fields[0].GetUInt32();
  67.         Itens.pClass = fields[1].GetInt32();
  68.         Itens.ItemSet = fields[2].GetInt8();
  69.         Itens.PTalentoTipo = fields[3].GetInt8();
  70.  
  71.         ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(Itens.itemID);
  72.         if (!pProto)
  73.         {
  74.             TC_LOG_ERROR("server.loading", "itemID [%u] nao-existe", Itens.itemID);
  75.             continue;
  76.         }      
  77.         TabelaItensList.push_back(Itens);
  78.         ++contador;
  79.     } while (resultados->NextRow());
  80.  
  81.     TC_LOG_INFO("server.loading", ">> Carregados %u Itens para AutoEquipe em %u ms", contador, GetMSTimeDiffToNow(sMSTime));
  82.  
  83.     return true;
  84. }
  85. //===========Equipar player
  86. bool EquiparItems(Player* player)
  87. {
  88.     PlayerInfo const* info = sObjectMgr->GetPlayerInfo(player->getRace(), player->getClass());
  89.     for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++)
  90.     {
  91.         for (PlayerCreateInfoActions::const_iterator action_itr = info->action.begin(); action_itr != info->action.end(); ++action_itr)
  92.             player->addActionButton(action_itr->button, action_itr->action, action_itr->type);
  93.         // original items
  94.         if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(player->getRace(), player->getClass(), player->getGender()))
  95.         {
  96.             for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
  97.             {
  98.                 if (oEntry->ItemId[j] <= 0)
  99.                     continue;
  100.                 uint32 itemId = oEntry->ItemId[j];
  101.                 // just skip, reported in ObjectMgr::LoadItemTemplates
  102.                 ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(itemId);
  103.                 if (!iProto)
  104.                     continue;
  105.                 // BuyCount by default
  106.                 uint32 count = iProto->BuyCount;
  107.                 // special amount for food/drink
  108.                 if (iProto->Class == ITEM_CLASS_CONSUMABLE && iProto->SubClass == ITEM_SUBCLASS_FOOD)
  109.                 {
  110.                     switch (iProto->Spells[0].SpellCategory)
  111.                     {
  112.                     case SPELL_CATEGORY_FOOD: // food
  113.                         count = player->getClass() == CLASS_DEATH_KNIGHT ? 10 : 4;
  114.                         break;
  115.                     case SPELL_CATEGORY_DRINK: // drink
  116.                         count = 2;
  117.                         break;
  118.                     }
  119.                     if (iProto->GetMaxStackSize() < count)
  120.                         count = iProto->GetMaxStackSize();
  121.                 }
  122.  
  123.                 uint32 pClass = player->getClassMask();
  124.                 uint8 pLevel = player->getLevel();
  125.  
  126.                 for (uint32 i = 0; i < TabelaItensList.size(); ++i)
  127.                 {
  128.                     TabelaItens &Itens = TabelaItensList[i];
  129.                     ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(Itens.itemID);
  130.  
  131.                     if (!(Itens.pClass & pClass)) continue;
  132.  
  133.                     if (pProto->RequiredLevel > pLevel) continue;
  134.  
  135.                 //  if (!(Itens.itemID & pProto->AllowableClass)) continue;
  136.                
  137.                     if (!(Itens.ItemSet & Arena_Season)) continue;
  138.  
  139.                     if (player->GetItemByEntry(Itens.itemID)){
  140.                         player->DestroyItemCount(Itens.itemID, 99, true); // remover
  141.                     }
  142.                     if (player->HasItemCount(Itens.itemID, 1)) continue;
  143.  
  144.                     if (Itens.itemID == 51809){ // bag
  145.                         player->StoreNewItemInBestSlots(51809, 3);
  146.                     }
  147.                     if (Itens.itemID == 52021){
  148.                         player->StoreNewItemInBestSlots(52021, 200);
  149.                         player->SetAmmo(52021);
  150.                     }
  151.  
  152.                     player->StoreNewItemInBestSlots(Itens.itemID, 1);                                      
  153.                 }
  154.                 return true;
  155.  
  156.             }
  157.         }
  158.     }
  159.     return true;
  160. }//========Fim equipar player
  161.  
  162.  
  163. //===========Remover items Slot que não tam na lista Aray{}
  164. bool RemoverItemsSlostNoAray(Player* player)
  165. { // remove items do corpo e não remove da bag // verifica sim se esta com item no corpo
  166.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_HEAD))
  167.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_HEAD, true);
  168.  
  169.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_NECK))
  170.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_NECK, true);
  171.  
  172.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_SHOULDERS))
  173.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_SHOULDERS, true);
  174.  
  175.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_BODY))
  176.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_BODY, true);
  177.  
  178.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_CHEST))
  179.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_CHEST, true);
  180.  
  181.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_WAIST))
  182.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_WAIST, true);
  183.  
  184.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_LEGS))
  185.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_LEGS, true);
  186.  
  187.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_FEET))
  188.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_FEET, true);
  189.  
  190.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_WRISTS))
  191.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_WRISTS, true);
  192.  
  193.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_HANDS))
  194.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_HANDS, true);
  195.  
  196.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_FINGER1))
  197.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_FINGER1, true);
  198.  
  199.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_FINGER2))
  200.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_FINGER2, true);
  201.  
  202.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1))
  203.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1, true);
  204.  
  205.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET2))
  206.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET2, true);
  207.  
  208.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_BACK))
  209.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_BACK, true);
  210.  
  211.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
  212.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND, true);
  213.  
  214.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
  215.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND, true);
  216.  
  217.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
  218.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED, true);
  219.  
  220.     if (player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TABARD))
  221.     player->MoveItemFromInventory(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TABARD, true);
  222.    
  223.     return true;
  224. } //===========Fim Remover items Slot que não tam na lista Aray{}
  225.  
  226. void AplicarTalentosSpell(Player* player)
  227. {
  228.     player->ResetTalents(true);
  229.  
  230. /*  QueryResult result = CharacterDatabase.PQuery(ColunaTalentRank);
  231.     if (!result)
  232.     {
  233.         ChatHandler(player->GetSession()).PSendSysMessage("Sem resultado");
  234.     }
  235.     else
  236.     {
  237.         Field * fields = NULL;
  238.         do
  239.         {
  240.             Field * fields = result->Fetch();
  241.  
  242.             uint32 spell = fields[0].GetUInt32();
  243.             player->AddTalent(spell, 0, true);
  244.  
  245.             player->SetFreeTalentPoints(0);
  246.  
  247.              //         CharacterDatabase.PExecute("REPLACE INTO `character_spell` (`guid`, `spell`,`disabled`) VALUES(%u,%u,%u)", player->GetGUIDLow(), LearnSpell[i][0], LearnSpell[i][2]);
  248.  
  249.         } while (result->NextRow());
  250.         return;
  251.     } */
  252.     //return;
  253. }
  254.  
  255. void AplicarTalentos(Player* player)
  256. {
  257.     player->ResetTalents(true);
  258.  
  259. /*  QueryResult result = CharacterDatabase.PQuery(ColunaTalentRank);
  260.     if (!result)
  261.     {
  262.         TC_LOG_ERROR("network", "Nao tem talentos na database [%s] para a Class %u Tipo items: ", ColunaTalentRank, player->getClass());
  263.     }
  264.     else
  265.     {
  266.         Field * fields = NULL;
  267.  
  268.         do
  269.         {      
  270.             Field * fields = result->Fetch();
  271.  
  272.             uint32 spell = fields[0].GetUInt32();                          
  273.             player->LearnSpell(spell, false);
  274.  
  275.             if (!spell){
  276.                 TC_LOG_ERROR("network", "ERRO: Ao aplicar talentos Player [%s]", player->GetName().c_str());
  277.                 continue;
  278.             }
  279.             player->AddTalent(spell, 0, true);
  280.                        
  281.             player->SetFreeTalentPoints(0);
  282.  
  283.         } while (result->NextRow());           
  284.         return;
  285.     } */
  286.     //return;
  287. }
  288. // ===============================================================
  289. void TempoParaRelogar()
  290. {
  291.     clock_t temp;
  292.     temp = clock() + CLOCKS_PER_SEC + 9000;
  293.     while (clock() < temp) {}
  294. }
  295. void RelogarPlayer(Player* plrs)
  296. {
  297.     while (1)
  298.     {
  299.         ChatHandler(plrs->GetSession()).PSendSysMessage("Voce vai ser relogado em alguns segundos!..");
  300.         TempoParaRelogar();
  301.         plrs->GetSession()->LogoutRequest(100000.0f);
  302.         break;
  303.     }
  304. }
  305. // ==================================================================
  306. void ExecutarALLItens(Player* player, uint32 plevelup)
  307. {
  308.     if (AUTO_EQUIPADOR == true){
  309.         TreinarSpell_autoEquipe(player, plevelup);
  310.         RemoverItemsSlostNoAray(player);
  311.         EquiparItems(player); //Equiplar player
  312.     }
  313.     if (Relogar == true){
  314.         //  RelogarPlayer(player);
  315.         //  player->GetSession()->LogoutRequest(100000.0f);
  316.     }
  317.     player->UpdateMaxHealth(); // Update max Health (for add bonus from stamina)
  318.     player->SetFullHealth();
  319.     if (player->getPowerType() == POWER_MANA)
  320.     {
  321.         player->UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect)
  322.         player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
  323.     }
  324.     if (player->getPowerType() == POWER_RUNIC_POWER)
  325.     {
  326.         player->SetPower(POWER_RUNE, 8);
  327.         player->SetMaxPower(POWER_RUNE, 8);
  328.         player->SetPower(POWER_RUNIC_POWER, 0);
  329.         player->SetMaxPower(POWER_RUNIC_POWER, 1000);
  330.     }
  331.     player->UpdateAllStats();
  332.     player->SaveToDB();
  333. }
  334. void ExecutarALLTalentos(Player* player, uint32 plevelup)
  335. {
  336.     TreinarSpell_autoEquipe(player, plevelup);
  337.  
  338.     if (AUTO_EQUIPADOR == true){           
  339.         RemoverItemsSlostNoAray(player);
  340.         EquiparItems(player); //Equiplar player
  341.     }
  342.     if (AUTO_TALENTOS == true){
  343.         LearnTalentos(player);     
  344.     }
  345.     if (Relogar == true){
  346.         //  RelogarPlayer(player);
  347.         //  player->GetSession()->LogoutRequest(100000.0f);
  348.     }  
  349.     player->UpdateMaxHealth(); // Update max Health (for add bonus from stamina)
  350.     player->SetFullHealth();
  351.     if (player->getPowerType() == POWER_MANA)
  352.     {
  353.         player->UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect)
  354.         player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
  355.     }
  356.     if (player->getPowerType() == POWER_RUNIC_POWER)
  357.     {
  358.         player->SetPower(POWER_RUNE, 8);
  359.         player->SetMaxPower(POWER_RUNE, 8);
  360.         player->SetPower(POWER_RUNIC_POWER, 0);
  361.         player->SetMaxPower(POWER_RUNIC_POWER, 1000);
  362.     }
  363.     player->UpdateAllStats();
  364.     player->SaveToDB();
  365. }
  366.  
  367. void TreinadorAutoEquipeAtalho(Player* player, uint32 trainer)
  368. {
  369.     TreinarSpell_autoEquipe(player, trainer);
  370.    
  371.     player->UpdateMaxHealth(); // Update max Health (for add bonus from stamina)
  372.     player->SetFullHealth();
  373.     if (player->getPowerType() == POWER_MANA)
  374.     {
  375.         player->UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect)
  376.         player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
  377.     }
  378.     if (player->getPowerType() == POWER_RUNIC_POWER)
  379.     {
  380.         player->SetPower(POWER_RUNE, 8);
  381.         player->SetMaxPower(POWER_RUNE, 8);
  382.         player->SetPower(POWER_RUNIC_POWER, 0);
  383.         player->SetMaxPower(POWER_RUNIC_POWER, 1000);
  384.     }
  385.     player->UpdateAllStats();
  386.     player->SaveToDB();
  387.     return;
  388. }
  389.  
  390. // === DualTelatos====
  391. void EspecialzacaoDuelTalents(Player* player)
  392. {
  393.     if (player->GetSpecsCount() == 1)
  394.     {
  395.         if (player->getLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))
  396.         {
  397.             if (player->GetMoney() >= 3 * GOLD){ // 30.000 = 3k
  398.                 player->CastSpell(player, 63680, false, NULL, NULL, player->GetGUID()); //63651 para tirar
  399.                 player->CastSpell(player, 63624, true, NULL, NULL, player->GetGUID());
  400.                 player->CLOSE_GOSSIP_MENU();
  401.                 ChatHandler(player->GetSession()).PSendSysMessage("|cffFFFFFFEspecializacao Talentos Duplos adiquirida com sucesso!|r");
  402.                 player->SaveToDB();
  403.             }
  404.             else
  405.             {
  406.                 ChatHandler(player->GetSession()).PSendSysMessage("|cffFF0000Voce presisa de|r %u |cffFF0000de GOLD  para comprar Especializacao Talentos Duplos|r", 3 * GOLD);
  407.                 player->CLOSE_GOSSIP_MENU();
  408.             }
  409.         }
  410.         else
  411.         {
  412.             ChatHandler(player->GetSession()).PSendSysMessage("|cffFF0000Voce so pode pegar Especializacao Talentos Duplos apartido level|r %u", sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL));
  413.             player->CLOSE_GOSSIP_MENU();
  414.         }
  415.     }
  416.     else
  417.     {
  418.         ChatHandler(player->GetSession()).PSendSysMessage("|cffFF0000Voce ja tem Especializacao Talentos Duplos|r");
  419.         player->CLOSE_GOSSIP_MENU();
  420.     }
  421. }// === DualTelatos====Fim
  422.  
  423. // === Reset Talentos ===
  424. void RestarTalentos(Player* player, Creature* creature)
  425. {
  426.     if (player->GetFreeTalentPoints() == +player->CalculateTalentsPoints()){
  427.         ChatHandler(player->GetSession()).PSendSysMessage("|cffFF0000Seus talentos ja estam resetados!|r");
  428.         player->CLOSE_GOSSIP_MENU();
  429.     }
  430.     else
  431.     {
  432.         player->CLOSE_GOSSIP_MENU();
  433.         creature->CastSpell(player, 17251, false);
  434.         player->ResetTalents();
  435.         player->SetFreeTalentPoints(player->CalculateTalentsPoints());
  436.         ChatHandler(player->GetSession()).PSendSysMessage("|cff00FF00Talentos resetados com sucesso!|r");
  437.         player->SendTalentsInfoData(false);
  438.         player->SaveToDB();
  439.     }
  440. }// === Reset Talentos ===Fim
  441.  
  442. // Tempo para summonar a próxima vez
  443. std::map<uint32, uint32> MemoriaTempo;
  444. uint32 Minutos = 3;
  445. uint32 CalculateMinutos(uint32 m_time)
  446. {
  447.     if (m_time <= 60000)
  448.         Minutos = 1;
  449.     else if (m_time <= 120000)
  450.         Minutos = 2;
  451.     else if (m_time <= 180000) // 180000 = 3 minutes
  452.         Minutos = 3;
  453.  
  454.     return Minutos;
  455. }
  456.  
  457. // Não requer MultiTrainer nem MultiVendor
  458. void SumonarTrainerPorSpell(Player* player, Creature* _creature, uint32 TreinadorClasses)
  459. {
  460.     bool SumonarEM = true;
  461.     if (!MemoriaTempo.empty())
  462.     {
  463.         std::map<uint32, uint32>::iterator itr = MemoriaTempo.find(player->GetGUIDLow());
  464.         if (itr != MemoriaTempo.end())
  465.         if (GetMSTimeDiffToNow(itr->second) < 60000) // 3 minutos = 180000 | 2 minutos = 120000  | 1 minutos = 60000  e etc.
  466.         {
  467.             ChatHandler(player->GetSession()).PSendSysMessage("|cffFF0000Espere %u minuto(s) para poder summonar novamente.|r", CalculateMinutos(GetMSTimeDiffToNow(itr->second)));
  468.             SumonarEM = false;
  469.         }
  470.         else
  471.         {
  472.             MemoriaTempo.erase(player->GetGUIDLow());
  473.             SumonarEM = true;
  474.         }
  475.     }
  476.     // Tempo em que o npc fica sumonado e te seguinto
  477.     uint32 TEMPO__SUMMON = 60000; // 3 minutos = 180000 | 2 minutos = 120000  | 1 minutos = 60000  e etc.
  478.  
  479.     float x, y, z;
  480.     player->GetPosition(x, y, z);
  481.  
  482. #define summDruid player->SummonCreature(26324, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  483. #define summHunter player->SummonCreature(26325, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  484. #define summMage player->SummonCreature(26326, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  485. #define summPaladin player->SummonCreature(26327, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  486. #define summPriest player->SummonCreature(26328, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  487. #define summRogue player->SummonCreature(26329, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  488. #define summShaman player->SummonCreature(26330, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  489. #define summWarlock player->SummonCreature(26331, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  490. #define summWarrioR player->SummonCreature(26332, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  491. #define summDK player->SummonCreature(28474, x, y-1, z, +1, TEMPSUMMON_TIMED_DESPAWN, TEMPO__SUMMON)
  492. #define MeSeguir GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, _creature->GetFollowAngle() + 8)
  493.  
  494.     player->PlayerTalkClass->ClearMenus();
  495.     if (SumonarEM){
  496.         MemoriaTempo[player->GetGUIDLow()] = getMSTime();
  497.  
  498.         switch (TreinadorClasses = player->getClass())
  499.         {
  500.         case CLASS_WARRIOR:
  501.             summWarrioR->MeSeguir;
  502.             _creature->CastSpell(player, 44328, false);
  503.             break;
  504.         case CLASS_PALADIN:
  505.             summPaladin->MeSeguir;
  506.             _creature->CastSpell(player, 44328, false);
  507.             break;
  508.         case CLASS_DEATH_KNIGHT:
  509.             summDK->MeSeguir;
  510.             _creature->CastSpell(player, 44328, false);
  511.             break;
  512.         case CLASS_DRUID:
  513.             summDruid->MeSeguir;
  514.             _creature->CastSpell(player, 44328, false);
  515.             break;
  516.         case CLASS_HUNTER:
  517.             summHunter->MeSeguir;
  518.             _creature->CastSpell(player, 44328, false);
  519.             break;
  520.         case CLASS_MAGE:
  521.             summMage->MeSeguir;
  522.             _creature->CastSpell(player, 44328, false);
  523.             break;
  524.         case CLASS_PRIEST:
  525.             summPriest->MeSeguir;
  526.             _creature->CastSpell(player, 44328, false);
  527.             break;
  528.         case CLASS_ROGUE:
  529.             summRogue->MeSeguir;
  530.             _creature->CastSpell(player, 44328, false);
  531.             break;
  532.         case CLASS_WARLOCK:
  533.             summWarlock->MeSeguir;
  534.             _creature->CastSpell(player, 44328, false);
  535.             break;
  536.         case CLASS_SHAMAN:
  537.             summShaman->MeSeguir;
  538.             _creature->CastSpell(player, 44328, false);
  539.             break;
  540.  
  541.         default:
  542.             return;
  543.         }
  544.     }
  545.     return;
  546.     /*
  547.     player->CastSpell(player, 47359, false); // Trenador Druid
  548.     player->CastSpell(player, 47360, false); // Trenador Hunter
  549.     player->CastSpell(player, 47361, false); // Tranador Mage
  550.     player->CastSpell(player, 47362, false); // Tranador Paladin
  551.     player->CastSpell(player, 47363, false); // Tranador Priest
  552.     player->CastSpell(player, 47364, false); // Tranador Rogue
  553.     player->CastSpell(player, 47365, false); // Tranador Shaman
  554.     player->CastSpell(player, 47366, false); // Tranador Warlock
  555.     player->CastSpell(player, 47367, false); // Trenador WarrioR
  556.     */
  557. }
  558.  
  559. /*
  560. // Requer MultiTrainer
  561. void TrenadoresOriginais(Player* player, Creature* creature, uint8 TrainerClass)
  562. {
  563.     uint8 GetRace = player->GetTeam() == ALLIANCE;
  564.  
  565.     switch (TrainerClass = player->getClass())
  566.     {
  567.     case CLASS_WARRIOR:
  568.         if (GetRace)
  569.             player->GetSession()->SendTrainerList(creature->GetGUID(), 914);
  570.         player->GetSession()->SendTrainerList(creature->GetGUID(), 3408);
  571.             break;
  572.     case CLASS_PALADIN:
  573.         if (GetRace)
  574.             player->GetSession()->SendTrainerList(creature->GetGUID(), 5491);
  575.         player->GetSession()->SendTrainerList(creature->GetGUID(), 23128);
  576.         break;
  577.     case CLASS_DEATH_KNIGHT:
  578.             player->GetSession()->SendTrainerList(creature->GetGUID(), 28474);
  579.             break;
  580.     case CLASS_DRUID:
  581.         if (GetRace)
  582.             player->GetSession()->SendTrainerList(creature->GetGUID(), 5504);
  583.         player->GetSession()->SendTrainerList(creature->GetGUID(), 16655);
  584.         break;
  585.     case CLASS_HUNTER:
  586.         if (GetRace)
  587.             player->GetSession()->SendTrainerList(creature->GetGUID(), 5515);
  588.         player->GetSession()->SendTrainerList(creature->GetGUID(), 3352);
  589.         break;
  590.     case CLASS_MAGE:
  591.         if (GetRace)
  592.             player->GetSession()->SendTrainerList(creature->GetGUID(), 5498);
  593.         player->GetSession()->SendTrainerList(creature->GetGUID(), 5885);
  594.         break;
  595.     case CLASS_PRIEST:
  596.         if (GetRace)
  597.             player->GetSession()->SendTrainerList(creature->GetGUID(), 5489);
  598.         player->GetSession()->SendTrainerList(creature->GetGUID(), 6018);
  599.         break;
  600.     case CLASS_ROGUE:
  601.         if (GetRace)
  602.             player->GetSession()->SendTrainerList(creature->GetGUID(), 13283);
  603.         player->GetSession()->SendTrainerList(creature->GetGUID(), 3328);
  604.         break;
  605.     case CLASS_SHAMAN:
  606.         if (GetRace)
  607.             player->GetSession()->SendTrainerList(creature->GetGUID(), 20407);
  608.         player->GetSession()->SendTrainerList(creature->GetGUID(), 3344);
  609.         break;
  610.     case CLASS_WARLOCK:
  611.         if (GetRace)
  612.             player->GetSession()->SendTrainerList(creature->GetGUID(), 5496);
  613.         player->GetSession()->SendTrainerList(creature->GetGUID(), 3325);
  614.         break;
  615.  
  616.     }
  617.     return;
  618. }
  619.  
  620. // Requer MultiVendor
  621. bool VendedorClyphs(Player* player, Creature* creature)
  622. {
  623.     if (player->getClass() == CLASS_WARRIOR)
  624.         player->GetSession()->SendListInventory(creature->GetGUID(), 99901);
  625.     if (player->getClass() == CLASS_PALADIN)
  626.         player->GetSession()->SendListInventory(creature->GetGUID(), 99902);
  627.     if (player->getClass() == CLASS_MAGE)
  628.         player->GetSession()->SendListInventory(creature->GetGUID(), 99903);
  629.     if (player->getClass() == CLASS_HUNTER)
  630.         player->GetSession()->SendListInventory(creature->GetGUID(), 99904);
  631.     if (player->getClass() == CLASS_DRUID)
  632.         player->GetSession()->SendListInventory(creature->GetGUID(), 99905);
  633.     if (player->getClass() == CLASS_WARLOCK)
  634.         player->GetSession()->SendListInventory(creature->GetGUID(), 99906);
  635.     if (player->getClass() == CLASS_PRIEST)
  636.         player->GetSession()->SendListInventory(creature->GetGUID(), 99907);
  637.     if (player->getClass() == CLASS_ROGUE)
  638.         player->GetSession()->SendListInventory(creature->GetGUID(), 99908);
  639.     if (player->getClass() == CLASS_DEATH_KNIGHT)
  640.         player->GetSession()->SendListInventory(creature->GetGUID(), 99909);
  641.     if (player->getClass() == CLASS_SHAMAN)
  642.         player->GetSession()->SendListInventory(creature->GetGUID(), 99910);
  643.  
  644.     return true;
  645. } */
  646.  
  647. /*
  648. class PlayerAutoEquipar : public PlayerScript
  649. {
  650. public:
  651.     PlayerAutoEquipar() : PlayerScript("PlayerAutoEquipar") {}
  652.  
  653.     void OnLevelChanged(Player* player, uint8 )
  654.     {
  655.            
  656.     }
  657.     void OnLogin(Player* player, bool firstLogin)
  658.     {
  659.        
  660.            
  661.     }
  662.     bool OnGossipeHelo(Player* player, uint32 )
  663.     {
  664.  
  665.     }
  666. };
  667. */
  668.  
  669. /*  player->getClassMask();
  670.     1     1  Warrior                  
  671.     2     2  Paladin
  672.     4     3  Hunter
  673.     8     4  Rogue
  674.     16    5  Priest
  675.     32    6  Death Knight
  676.     64    7  Shaman
  677.     128   8  Mage
  678.     256   9  Warlock
  679.     1024 11  Druid 
  680.    
  681.     player->GetRaceMask()
  682.     1 | 1       Human
  683.     2 | 2       Orc
  684.     4 | 3       Dwarf
  685.     8 | 4       Night Elf
  686.     16 | 5      Undead
  687.     32 | 6      Tauren
  688.     64 | 7      Gnome
  689.     128 | 8     Troll
  690.     256 | 9     Goblin
  691.     512 | 10    Blood Elf
  692.     1024 | 11   Draenei
  693.  
  694.     player->GetTeamId()
  695.     ALLIANCE = 0
  696.     HORDE    = 1
  697.  
  698.     player->GetTeam()
  699.     ALLIANCE = 469
  700.     HORDE    = 67       */
  701.  
  702. class AutoEquipe_commands : public CommandScript
  703. {
  704. public:
  705.     AutoEquipe_commands() : CommandScript("AutoEquipe_commands") { }
  706.     ChatCommand* GetCommands() const
  707.     {
  708.         static ChatCommand AutoEquipeCommandTable[] =
  709.         {
  710.             { "autoequipe", SEC_PLAYER, false, &HandleReloadAutoEquipeCommand, "", NULL },
  711.             { NULL, 0, false, NULL, "", NULL }
  712.         };
  713.         return AutoEquipeCommandTable;
  714.     }
  715.     static bool HandleReloadAutoEquipeCommand(ChatHandler * handler, const char * args)
  716.     {
  717.         Player* player = handler->GetSession()->GetPlayer();
  718.         if (CarregarAutoEquipeSpellTalentos()){
  719.             TC_LOG_INFO("server.loading", "Carregando spellTalentos para AutoEquipe...");
  720.             handler->SendGlobalGMSysMessage("DB tabela character_talent_autoequipe carregada.");
  721.         }
  722.         return true;
  723.     }
  724. };
  725.  
  726. class npc_auto_equipe_WorldScript : public WorldScript
  727. {
  728. public:
  729.     npc_auto_equipe_WorldScript() : WorldScript("npc_auto_equipe_WorldScript") { }
  730.  
  731.  
  732.     void OnConfigLoad(bool)
  733.     {
  734.         Arena_Season = sConfigMgr->GetIntDefault("Arena.Season", 0);
  735.         Arena_Season_Name = sConfigMgr->GetStringDefault("Arena.Season_Name", "Arena Season x");
  736.         TIPO_DE_TRENADOR_ORIGINAL = sConfigMgr->GetIntDefault("Tipo.Treinador.Original", 0);
  737.  
  738.         LoadDataFromDataBase();
  739.     }
  740.     void LoadDataFromDataBase()
  741.     {
  742.     //  CarregarAutoEquipe();
  743.         CarregarAutoEquipeItens();
  744.         CarregarAutoEquipeSpellTalentos();
  745.     }      
  746.    
  747.     void OnStartup() override
  748.     {
  749.        
  750.     }
  751. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement