Welcome to JadaDev

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • JadaDev

      Themes   10/08/2018

      You're able to change theme in the bottom of the site.
Sign in to follow this  
Followers 0
Baynar

Hunter Pets all Talents

This is custom code from my server and i decided to share it.
What it does ? When a pet is created it will learn all the talents the pet has. Good for fun servers with all talents.
Core is TrinityCore 3.3.5.
in Pet.cpp find:
 

void Pet::InitTalentForLevel()

Replace with:
 

void Pet::InitTalentForLevel()
{
    if (sWorld->getBoolConfig(CONFIG_PET_ALL_TALENTS) == true)
    {
        LearnTalents();
    }
    else
    {
        uint8 level = getLevel();
        uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level);
        // Reset talents in case low level (on level down) or wrong points for level (hunter can unlearn TP increase talent)
        if (talentPointsForLevel == 0 || m_usedTalentCount > talentPointsForLevel)
            resetTalents(); // Remove all talent points

        SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);

        if (!m_loading)
            GetOwner()->SendTalentsInfoData(true);
    }
}

In Pet.h find:

void InitTalentForLevel();


Above it add:

 

void LearnTalents();
In Pet.cpp above void InitTalentForLevel() declare void LearnTalents();

 

void Pet::LearnTalents()
{
    Player* player = GetOwner();

    CreatureTemplate const* ci = GetCreatureTemplate();
    if (!ci)
        return;
    // Check pet talent type
    CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
    if (!pet_family || pet_family->petTalentType < 0)
        return;

    for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
    {
        TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);

        if (!talentInfo)
            continue;

        TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);

        if (!talentTabInfo)
            continue;

        // unlearn only talents for pets family talent type
        if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
            continue;

        // search highest talent rank
        uint32 spellId = 0;
        for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
        {
            if (talentInfo->RankID[rank] != 0)
            {
                spellId = talentInfo->RankID[rank];
                break;
            }
        }

        if (!spellId)                                        // ??? none spells in talent
            continue;

        SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
        if (!spellInfo)
            continue;

        // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
        learnSpellHighRank(spellId);
        addSpell(spellId);
    }

    SetFreeTalentPoints(0);

    if (!m_loading)
        player->PetSpellInitialize();

    if (!m_loading)
        player->SendTalentsInfoData(true);  // update at client
}
In World.h add in the Bool enum

 

CONFIG_PET_ALL_TALENTS
In World.cpp add below CONFIG_START_ALL_SPELLS

 

m_bool_configs[CONFIG_PET_ALL_TALENTS] = sConfigMgr->GetBoolDefault("PlayerPet.AllTalents", false);
In your worldserver.conf file add

 

#
#    PlayerPet.AllTalents
#        Description: If enabled, player pets will start with all talents.
#        Default:     0 - (Disabled)
#                     1 - (Enabled)

 PlayerPet.AllTalents = 0
Quote

 

 

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0