diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Chat.h | 1 | ||||
-rw-r--r-- | src/game/DBCStructure.h | 2 | ||||
-rw-r--r-- | src/game/DBCfmt.h | 2 | ||||
-rw-r--r-- | src/game/Level2.cpp | 115 | ||||
-rw-r--r-- | src/game/SpellAuraDefines.h | 6 | ||||
-rw-r--r-- | src/game/Unit.cpp | 1 |
6 files changed, 62 insertions, 65 deletions
diff --git a/src/game/Chat.h b/src/game/Chat.h index 725217ef69b..0b8b076969b 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -597,6 +597,7 @@ class ChatHandler bool HandleBanInfoHelper(uint32 accountid, char const* accountname); bool HandleUnBanHelper(BanMode mode,char const* args); void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel); + void HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id); void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; private: diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 486b840f5d6..c35048548bb 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1277,7 +1277,7 @@ struct SkillLineEntry uint32 spellIcon; // 37 m_spellIconID //char* alternateVerb[16]; // 38-53 m_alternateVerb_lang // 54 string flags - // 55 m_canLink + uint32 canLink; // 55 m_canLink (prof. with recipes }; struct SkillLineAbilityEntry diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 9187cc85e3d..cf3d723a364 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -81,7 +81,7 @@ const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii"; const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiii"; -const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxx"; +const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi"; const char SkillLineAbilityfmt[]="niiiixxiiiiixx"; const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellCastTimefmt[]="nixx"; diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index a2c5a733d97..70baff4f42e 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -3890,6 +3890,40 @@ bool ChatHandler::HandleCombatStopCommand(const char* args) return true; } +void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id) +{ + uint32 classmask = player->getClassMask(); + + for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + { + SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); + if (!skillLine) + continue; + + // wrong skill + if( skillLine->skillId != skill_id) + continue; + + // not high rank + if(skillLine->forward_spellid ) + continue; + + // skip racial skills + if (skillLine->racemask != 0) + continue; + + // skip wrong class skills + if( skillLine->classmask && (skillLine->classmask & classmask) == 0) + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); + if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,player,false)) + continue; + + player->learnSpell(skillLine->spellId,false); + } +} + bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) { uint32 classmask = m_session->GetPlayer()->getClassMask(); @@ -3900,31 +3934,10 @@ bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) if( !skillInfo ) continue; - if( skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY ) + if ((skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY) && + skillInfo->canLink) // only prof. with recipes have { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) - { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); - if( !skillLine ) - continue; - - // skip racial skills - if( skillLine->racemask != 0 ) - continue; - - // skip wrong class skills - if( skillLine->classmask && (skillLine->classmask & classmask) == 0) - continue; - - if( skillLine->skillId != i || skillLine->forward_spellid ) - continue; - - SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); - if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) - continue; - - m_session->GetPlayer()->learnSpell(skillLine->spellId,false); - } + HandleLearnSkillRecipesHelper(m_session->GetPlayer(),skillInfo->id); } } @@ -3958,55 +3971,39 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) wstrToLower( wnamepart ); uint32 classmask = m_session->GetPlayer()->getClassMask(); + std::string name; - for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) + SkillLineEntry const *targetSkillInfo = NULL; + for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); - if( !skillInfo ) + if (!skillInfo) continue; - if( skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && - skillInfo->categoryId != SKILL_CATEGORY_SECONDARY ) + if ((skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && + skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) || + !skillInfo->canLink) // only prof with recipes have set continue; int loc = GetSessionDbcLocale(); - std::string name = skillInfo->name[loc]; + name = skillInfo->name[loc]; if(Utf8FitTo(name, wnamepart)) { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) - { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); - if( !skillLine ) - continue; - - if( skillLine->skillId != i || skillLine->forward_spellid ) - continue; - - // skip racial skills - if( skillLine->racemask != 0 ) - continue; - - // skip wrong class skills - if( skillLine->classmask && (skillLine->classmask & classmask) == 0) - continue; - - SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); - if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) - continue; - - if( !target->HasSpell(spellInfo->Id) ) - m_session->GetPlayer()->learnSpell(skillLine->spellId,false); - } - - uint16 maxLevel = target->GetPureMaxSkillValue(skillInfo->id); - target->SetSkill(skillInfo->id, maxLevel, maxLevel); - PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); - return true; + targetSkillInfo = skillInfo; + break; } } - return false; + if(!targetSkillInfo) + return false; + + HandleLearnSkillRecipesHelper(target,targetSkillInfo->id); + + uint16 maxLevel = target->GetPureMaxSkillValue(targetSkillInfo->id); + target->SetSkill(targetSkillInfo->id, maxLevel, maxLevel); + PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); + return true; } bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index 494bdc68a88..8dd39552eb2 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -91,9 +91,9 @@ enum AuraType SPELL_AURA_PROC_TRIGGER_DAMAGE = 43, SPELL_AURA_TRACK_CREATURES = 44, SPELL_AURA_TRACK_RESOURCES = 45, - SPELL_AURA_46 = 46, // Ignore all Gear test spells + SPELL_AURA_46 = 46, // Ignore all Gear test spells SPELL_AURA_MOD_PARRY_PERCENT = 47, - SPELL_AURA_48 = 48, // One periodic spell + SPELL_AURA_48 = 48, // One periodic spell SPELL_AURA_MOD_DODGE_PERCENT = 49, SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT = 50, SPELL_AURA_MOD_BLOCK_PERCENT = 51, @@ -135,7 +135,7 @@ enum AuraType SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN = 87, SPELL_AURA_MOD_HEALTH_REGEN_PERCENT = 88, SPELL_AURA_PERIODIC_DAMAGE_PERCENT = 89, - SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE + SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE SPELL_AURA_MOD_DETECT_RANGE = 91, SPELL_AURA_PREVENTS_FLEEING = 92, SPELL_AURA_MOD_UNATTACKABLE = 93, diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3a813a80da7..3e3bf254af5 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9278,7 +9278,6 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama break; } - if(pVictim) { uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); |