mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-13 21:01:08 -04:00
Update CreatureObject.cpp
Fixed some expertise issues (thanks @AlecH92)
This commit is contained in:
@@ -14448,29 +14448,17 @@ bool CreatureObject::getUseLookAtYaw() const
|
||||
|
||||
int CreatureObject::getExpertiseRankForPlayer(std::string const & expertiseName)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
int rankMax = ExpertiseManager::getExpertiseRankMax(expertiseName);
|
||||
|
||||
int tree = ExpertiseManager::getExpertiseTree(expertiseName);
|
||||
int tier = ExpertiseManager::getExpertiseTier(expertiseName);
|
||||
int grid = ExpertiseManager::getExpertiseGrid(expertiseName);
|
||||
int rank = 1;
|
||||
int rank = ExpertiseManager::getExpertiseRank(expertiseName);
|
||||
SkillObject const * skill = ExpertiseManager::getExpertiseSkillAt(tree, tier, grid, rank);
|
||||
|
||||
while (rank <= rankMax)
|
||||
if (skill && hasSkill(*skill))
|
||||
{
|
||||
SkillObject const * skill = ExpertiseManager::getExpertiseSkillAt(tree, tier, grid, rank);
|
||||
if (skill && hasSkill(*skill))
|
||||
{
|
||||
result = rank;
|
||||
rank++;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -14545,13 +14533,20 @@ bool CreatureObject::processExpertiseRequest(std::vector<std::string> const &add
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
for(int z = 1; z < 6; z++)
|
||||
{
|
||||
//this for loop goes through the tiers so we try to add by level rather than by the order we received the skill list.
|
||||
for(std::vector<std::string>::const_iterator i = addExpertisesNamesList.begin(); i != addExpertisesNamesList.end(); ++i)
|
||||
{
|
||||
std::string const &s = *i;
|
||||
const SkillObject *skill = SkillManager::getInstance().getSkill(s);
|
||||
if(skill)
|
||||
{
|
||||
int tier = ExpertiseManager::getExpertiseTier(s);
|
||||
if(tier != z)
|
||||
{
|
||||
continue; //skip over this skill - we didn't match the tier level. we'll catch it next loop through.
|
||||
}
|
||||
//Check prerequisites
|
||||
SkillObject::SkillVector const prereqs = skill->getPrerequisiteSkills();
|
||||
for (SkillObject::SkillVector::const_iterator i = prereqs.begin(); i != prereqs.end(); ++i)
|
||||
@@ -14559,8 +14554,7 @@ bool CreatureObject::processExpertiseRequest(std::vector<std::string> const &add
|
||||
SkillObject const * prereq = (*i);
|
||||
if (!prereq || !hasSkill(*prereq))
|
||||
{
|
||||
DEBUG_WARNING(true, ("player %s tried to get expertise %s but doesn't have expertise %s", getNetworkId().getValueString().c_str(),
|
||||
skill->getSkillName().c_str(), prereq->getSkillName().c_str()));
|
||||
LOG("CustomerService", ("SuspectedCheaterChannel: %s tried to get expertise %s but doesn't have expertise %s", PlayerObject::getAccountDescription(this).c_str(), skill->getSkillName().c_str(), prereq->getSkillName().c_str()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -14571,9 +14565,7 @@ bool CreatureObject::processExpertiseRequest(std::vector<std::string> const &add
|
||||
int tier = ExpertiseManager::getExpertiseTier(s);
|
||||
if (pointsInTree < (tier - 1) * POINTS_PER_TIER)
|
||||
{
|
||||
DEBUG_WARNING(true, ("player %s tried to get expertise %s but only has %d points in tree %d, needs %d", getNetworkId().getValueString().c_str(),
|
||||
s.c_str(), pointsInTree, tree, (tier - 1) * POINTS_PER_TIER
|
||||
));
|
||||
LOG("CustomerService", ("SuspectedCheaterChannel: %s tried to get expertise %s but only has %d points in tree %d, needs %d", PlayerObject::getAccountDescription(this).c_str(), s.c_str(), pointsInTree, tree, (tier - 1) * POINTS_PER_TIER));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14593,6 +14585,7 @@ bool CreatureObject::processExpertiseRequest(std::vector<std::string> const &add
|
||||
grantSkill(*skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user