Esempio n. 1
0
uint32 GetTalentSpellCost(uint32 spellId)
{
    if(TalentSpellPos const* pos = GetTalentSpellPos(spellId))
        return pos->rank+1;

    return 0;
}
Esempio n. 2
0
int AiFactory::GetPlayerSpecTab(Player* player)
{
    int c0 = 0, c1 = 0, c2 = 0;
    PlayerTalentMap& talentMap = player->GetTalentMap(0);
    for (PlayerTalentMap::iterator i = talentMap.begin(); i != talentMap.end(); ++i)
    {
        uint32 spellId = i->first;
        TalentSpellPos const* talentPos = GetTalentSpellPos(spellId);
        if(!talentPos)
            continue;

        TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id);
        if (!talentInfo)
            continue;

        uint32 const* talentTabIds = GetTalentTabPages(player->getClass());
        if (talentInfo->TalentTab == talentTabIds[0]) c0++;
        if (talentInfo->TalentTab == talentTabIds[1]) c1++;
        if (talentInfo->TalentTab == talentTabIds[2]) c2++;
    }

    if (c0 >= c1 && c0 >= c2)
        return 0;

    if (c1 >= c0 && c1 >= c2)
        return 1;

    return 2;
}
bool CharacterDatabaseCleaner::SpellCheck(uint32 spell_id) {
	return sSpellStore.LookupEntry(spell_id) && !GetTalentSpellPos(spell_id);
}
Esempio n. 4
0
uint32 GetTalentSpellCost(uint32 spellId)
{
    return GetTalentSpellCost(GetTalentSpellPos(spellId));
}
bool CharacterDatabaseCleaner::SpellCheck(uint32 spell_id)
{
    return sSpellMgr->GetSpellInfo(spell_id) && !GetTalentSpellPos(spell_id);
}
        void LearnSpellsForNewLevel(Player* player, uint8 level)
        {
                if (level == player->getLevel() + 1)
                        return;
                uint32 family;
                switch(player->getClass())
                {
                        case CLASS_ROGUE:
                                family = SPELLFAMILY_ROGUE;
                                break;
                        case CLASS_DEATH_KNIGHT:
                                family = SPELLFAMILY_DEATHKNIGHT;
                                break;
                        case CLASS_WARRIOR:
                                family = SPELLFAMILY_WARRIOR;
                                break;
                        case CLASS_PRIEST:
                                family = SPELLFAMILY_PRIEST;
                                break;
                        case CLASS_MAGE:
                                family = SPELLFAMILY_MAGE;
                                break;
                        case CLASS_PALADIN:
                                family = SPELLFAMILY_PALADIN;
                                break;
                        case CLASS_HUNTER:
                                family = SPELLFAMILY_HUNTER;
                                break;
                        case CLASS_DRUID:
                                family = SPELLFAMILY_DRUID;
                                break;
                        case CLASS_SHAMAN:
                                family = SPELLFAMILY_SHAMAN;
                                break;
                        case CLASS_WARLOCK:
                                family = SPELLFAMILY_WARLOCK;
                                break;
                }
                for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
                {
                        SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i);
                        if (!spellInfo)
                                continue;
                        if (spellInfo->SpellFamilyName != family)
                                continue;
                        if (IsIgnoredSpell(spellInfo->Id))
                                continue;
                        if (spellInfo->PowerType == POWER_FOCUS)
                                continue;
            if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, player))
                                continue;
            if ((spellInfo->AttributesEx7 & SPELL_ATTR7_ALLIANCE_ONLY && player->GetTeam() != ALLIANCE) || (spellInfo->AttributesEx7 & SPELL_ATTR7_HORDE_ONLY && player->GetTeam() != HORDE))
                                continue;
            if (spellInfo->BaseLevel != level && sSpellMgr->IsSpellValid(spellInfo, player))
                continue;
 
                        bool valid = false;
 
                        SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellInfo->Id);
                        for (SkillLineAbilityMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
                        {
                                if (itr->second->spellId == spellInfo->Id && itr->second->racemask == 0 && itr->second->learnOnGetSkill == 0)
                                {
                    valid = true;
                    SpellInfo const* prevSpell = spellInfo->GetPrevRankSpell();
                    if (prevSpell && !player->HasSpell(prevSpell->Id))
                    {
                        valid = false;
                        break;
                    }
                    if (GetTalentSpellPos(itr->second->spellId))
                        if (!prevSpell || !player->HasSpell(prevSpell->Id) || spellInfo->GetRank() == 1)
                            valid = false;
                    break;
                                }
                        }
 
                        if (valid)
                                player->learnSpell(spellInfo->Id, false);
                }
                LearnSpellsForNewLevel(player, ++level);
        }