mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 00:06:11 +00:00
fix(Core/Player): Use SkillLineAbility.dbc to determine player initia… (#6015)
* fix(Core/Player): Use SkillLineAbility.dbc to determine player initial spells - skill assignment done in a new table `playercreateinfo_skills` * Cherry-pick2a3546ca36* Cherry-Pickd28b66bca8* Cherry-Pick193408f335- Closes https://github.com/azerothcore/azerothcore-wotlk/issues/1659 - Closes https://github.com/azerothcore/azerothcore-wotlk/issues/6036 - Closes https://github.com/chromiecraft/chromiecraft/issues/693 Co-Authored-By: Shauren shauren.trinity@gmail.com Co-Authored-By: Rothend 67004168+Rothend@users.noreply.github.com Co-Authored-By: claudiodfc claudio.daniel.f.c@gmail.com
This commit is contained in:
@@ -3485,17 +3485,90 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
}
|
||||
}
|
||||
|
||||
// Load playercreate skills
|
||||
LOG_INFO("server.loading", "Loading Player Create Skill Data...");
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
QueryResult result = WorldDatabase.PQuery("SELECT raceMask, classMask, skill, `rank` FROM playercreateinfo_skills");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
LOG_ERROR("server.loading", ">> Loaded 0 player create skills. DB table `playercreateinfo_skills` is empty.");
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 raceMask = fields[0].GetUInt32();
|
||||
uint32 classMask = fields[1].GetUInt32();
|
||||
PlayerCreateInfoSkill skill;
|
||||
skill.SkillId = fields[2].GetUInt16();
|
||||
skill.Rank = fields[3].GetUInt16();
|
||||
|
||||
if (skill.Rank >= MAX_SKILL_STEP)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Skill rank value %hu set for skill %hu raceMask %u classMask %u is too high, max allowed value is %d", skill.Rank, skill.SkillId, raceMask, classMask, MAX_SKILL_STEP);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_skills` table, ignoring.", raceMask);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_skills` table, ignoring.", classMask);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sSkillLineStore.LookupEntry(skill.SkillId))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Wrong skill id %u in `playercreateinfo_skills` table, ignoring.", skill.SkillId);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32 raceIndex = RACE_HUMAN; raceIndex < MAX_RACES; ++raceIndex)
|
||||
{
|
||||
if (raceMask == 0 || ((1 << (raceIndex - 1)) & raceMask))
|
||||
{
|
||||
for (uint32 classIndex = CLASS_WARRIOR; classIndex < MAX_CLASSES; ++classIndex)
|
||||
{
|
||||
if (classMask == 0 || ((1 << (classIndex - 1)) & classMask))
|
||||
{
|
||||
if (!GetSkillRaceClassInfo(skill.SkillId, raceIndex, classIndex))
|
||||
continue;
|
||||
|
||||
if (PlayerInfo* info = _playerInfo[raceIndex][classIndex])
|
||||
{
|
||||
info->skills.push_back(skill);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u player create skills in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
}
|
||||
|
||||
// Load playercreate spells
|
||||
LOG_INFO("server.loading", "Loading Player Create Spell Data...");
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
std::string tableName = sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell";
|
||||
QueryResult result = WorldDatabase.PQuery("SELECT racemask, classmask, Spell FROM %s", tableName.c_str());
|
||||
QueryResult result = WorldDatabase.PQuery("SELECT racemask, classmask, Spell FROM playercreateinfo_spell_custom");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell");
|
||||
LOG_INFO("server.loading", ">> Loaded 0 player create spells. DB table `playercreateinfo_spell_custom` is empty.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3510,13 +3583,13 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
|
||||
if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_spell` table, ignoring.", raceMask);
|
||||
LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_spell_custom` table, ignoring.", raceMask);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_spell` table, ignoring.", classMask);
|
||||
LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_spell_custom` table, ignoring.", classMask);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3530,7 +3603,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
{
|
||||
if (PlayerInfo* info = _playerInfo[raceIndex][classIndex])
|
||||
{
|
||||
info->spell.push_back(spellId);
|
||||
info->customSpells.push_back(spellId);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@@ -3539,7 +3612,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", ">> Loaded %u custom player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
}
|
||||
@@ -7943,37 +8016,33 @@ int32 ObjectMgr::GetBaseReputationOf(FactionEntry const* factionEntry, uint8 rac
|
||||
return 0;
|
||||
}
|
||||
|
||||
SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial)
|
||||
SkillRangeType GetSkillRangeType(SkillRaceClassInfoEntry const* rcEntry)
|
||||
{
|
||||
switch (pSkill->categoryId)
|
||||
SkillLineEntry const* skill = sSkillLineStore.LookupEntry(rcEntry->SkillID);
|
||||
if (!skill)
|
||||
{
|
||||
return SKILL_RANGE_NONE;
|
||||
}
|
||||
|
||||
if (sSkillTiersStore.LookupEntry(rcEntry->SkillTierID))
|
||||
{
|
||||
return SKILL_RANGE_RANK;
|
||||
}
|
||||
|
||||
if (rcEntry->SkillID == SKILL_RUNEFORGING)
|
||||
{
|
||||
return SKILL_RANGE_MONO;
|
||||
}
|
||||
|
||||
switch (skill->categoryId)
|
||||
{
|
||||
case SKILL_CATEGORY_ARMOR:
|
||||
return SKILL_RANGE_MONO;
|
||||
case SKILL_CATEGORY_LANGUAGES:
|
||||
return SKILL_RANGE_LANGUAGE;
|
||||
case SKILL_CATEGORY_WEAPON:
|
||||
if (pSkill->id != SKILL_FIST_WEAPONS)
|
||||
return SKILL_RANGE_LEVEL;
|
||||
else
|
||||
return SKILL_RANGE_MONO;
|
||||
case SKILL_CATEGORY_ARMOR:
|
||||
case SKILL_CATEGORY_CLASS:
|
||||
if (pSkill->id != SKILL_LOCKPICKING)
|
||||
return SKILL_RANGE_MONO;
|
||||
else
|
||||
return SKILL_RANGE_LEVEL;
|
||||
case SKILL_CATEGORY_SECONDARY:
|
||||
case SKILL_CATEGORY_PROFESSION:
|
||||
// not set skills for professions and racial abilities
|
||||
if (IsProfessionSkill(pSkill->id))
|
||||
return SKILL_RANGE_RANK;
|
||||
else if (racial)
|
||||
return SKILL_RANGE_NONE;
|
||||
else
|
||||
return SKILL_RANGE_MONO;
|
||||
default:
|
||||
case SKILL_CATEGORY_ATTRIBUTES: //not found in dbc
|
||||
case SKILL_CATEGORY_GENERIC: //only GENERIC(DND)
|
||||
return SKILL_RANGE_NONE;
|
||||
}
|
||||
|
||||
return SKILL_RANGE_LEVEL;
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameTele()
|
||||
|
||||
Reference in New Issue
Block a user