• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

TrinityCore 3.3.5 Npc Tools - Update

Lstm

Respected Member
There are other scripts with the same idea, however I come bringing news to each selected menu it indicates an aura referring to what has been chosen you!
Note: Script Updated to the latest revision of TrinityCore

sorry my bad english!

■■ NPC - TOOLS

O que ele faz?
Reset HP & MP
Reset Instance
Reset Cooldowns
Reset Combat
Romove Sickness
Repair Item
Reset Talents


■■ DOWNLOAD

Code:
#include "Player.h"
#include "Define.h"
#include "Creature.h"
#include "ScriptMgr.h"
#include "WorldSession.h"
#include "ScriptedGossip.h"
#include "Language.h"
class Tools_NPC : public CreatureScript
{
public:
        Tools_NPC() : CreatureScript("Tools_NPC") { }
 
        bool OnGossipHello(Player *player, Creature *creature)
        {
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\Spell_Nature_Regenerate:40:40:-14|t Restaurar HP and MP", GOSSIP_SENDER_MAIN, 1);			// Restaurar HP and MP
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\Achievement_BG_winAB_underXminutes:40:40:-14|t Resetar Instances", GOSSIP_SENDER_MAIN, 2);	// Resetar Instances
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\SPELL_HOLY_BORROWEDTIME:40:40:-14|t Resetar Cooldowns", GOSSIP_SENDER_MAIN, 3);				// Resetar Cooldowns
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\Achievement_BG_AB_defendflags:40:40:-14|t Resetar Combate", GOSSIP_SENDER_MAIN, 4);			// Resetar Combate
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\Spell_Shadow_DeathScream:40:40:-14|t Remover Sickness", GOSSIP_SENDER_MAIN, 5);				// Remover Sickness
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\INV_Hammer_24:40:40:-14|t Reparar Items", GOSSIP_SENDER_MAIN, 6);							// Reparar Items
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\Achievement_WorldEvent_Lunar:40:40:-14|t Resetar Talents", GOSSIP_SENDER_MAIN, 7);			// Resetar Talents
		//player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\Achievement_WorldEvent_Lunar:40:40:-14|t Sair", GOSSIP_SENDER_MAIN, 8);					// Sair
		player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
                return true;
        }
        bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 action)
        {
                player->PlayerTalkClass->ClearMenus();
                switch(action)
                {
                case 1: // Restaurar HP e MP
                        if(player->IsInCombat())
                        {
                            player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFVocê está em combate!");
							player->PlayerTalkClass->SendCloseGossip();
                                return false;
                        }
                        else if(player->getPowerType() == POWER_MANA)
                                player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
 
							player->SetHealth(player->GetMaxHealth());
							player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFHP & MP Resetados com Sucesso!");
							player->CastSpell(player, 36400);
							player->CLOSE_GOSSIP_MENU();
                        break;

                case 2: // Resetar Instances
                        for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
                        {
                                Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
                                for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
                                {
                                        player->UnbindInstance(itr, Difficulty(i));
                                }
                        }
						player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFInstances Resetados com Sucesso!");
						player->CastSpell(player, 59908);
                        player->CLOSE_GOSSIP_MENU();
                        break;

                case 3: // Resetar Cooldowns
                        if(player->IsInCombat())
                        {
                            player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFVocê está em combate!");
							player->PlayerTalkClass->SendCloseGossip();
                                return false;
                        }
 
						player->GetSpellHistory()->ResetAllCooldowns();
						player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFCooldowns Resetados com Sucesso!");
						player->CastSpell(player, 463);
                        player->CLOSE_GOSSIP_MENU();
                        break;

                case 4: // Resetar Combat
                        player->CombatStop();
						player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFCombate Removido com Sucesso!");
						player->CastSpell(player, 24222);
                        player->CLOSE_GOSSIP_MENU();
                        break;

                case 5: // Remover Sickness
                        if(player->HasAura(15007))
                        player->RemoveAura(15007);
						player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFSickness Removido com Sucesso!");
						player->CastSpell(player, 41300);
                        player->CLOSE_GOSSIP_MENU();
                        break;

                case 6: // Reparar Items
                        player->DurabilityRepairAll(false, 0, false);
						player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFEquipamentos Reparados com Sucesso!");
						player->CastSpell(player, 29541);
                        player->CLOSE_GOSSIP_MENU();
                        break;

               case 7: // Resetar Talents
                        player->ResetTalents(true);
                        player->SendTalentsInfoData(false);
						player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFTalentos Resetados com Sucesso!");
						player->CastSpell(player, 19484);
                        player->CLOSE_GOSSIP_MENU();
                        break;

				/*case 8: // Fechar Menu
						player->GetSession()->SendNotification("|cffFFFF00MTG - NPC TOOLS \n |cffFFFFFFObrigado, Utilize sempre esta ferramenta assim que precisar!");
						player->CLOSE_GOSSIP_MENU();
						break;*/
             }
                return true;
        }
};
 
void AddSC_Tools_NPC()
{
        new Tools_NPC();
}

■■ SQL NPC

Code:
SET
@Entry = 1000003,
@Name = "Npc Tools",
@SubName = "MtgCore",
@ScriptName = 'Tools_NPC';

INSERT INTO `creature_template` (`entry`, `modelid1`, `modelid2`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `scale`, `rank`, `dmgschool`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES
(@Entry, 19646, 0, @Name, @SubName, NULL, 0, 80, 80, 2, 35, 1, 1, 0, 0, 2000, 0, 1, 0, 7, 138936390, 0, 0, 0, '', 0, 3, 1, 0, 0, 1, 0, 0, @ScriptName);


■■ SCREEN SHOT

http://i.imgur.com/GHiNAGn.png
http://i.imgur.com/jWcLbZZ.png
http://i.imgur.com/hUeKbSK.png
http://i.imgur.com/wXsBS8k.png
http://i.imgur.com/1t9PiwP.png
http://i.imgur.com/7Dopc2B.png
http://i.imgur.com/h3vQ8W4.png
http://i.imgur.com/VdzeEHC.png
 
Last edited:

Tommy

Founder
Thanks for sharing.

Tips:

Indentation could use some tlc and if you're going to use "player->CLOSE_GOSSIP_MENU();" on every case you might as well take it out of each case and add it at the bottom or top of OnGossipSelect function.
 
Top