mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
[Bug Fix] Class Trainers dont steal your money! (#3864)
* [Bug Fix] Class Trainers dont steal your money! Class trainers log an error when you have reached your max train in the specific skill. They will continue to "Appear" to eat money and practices however they will be returned on logout/in or zone. * Remove un-needed logic due to legacy code. * more cleanup
This commit is contained in:
parent
8fa6a0b496
commit
20e9a8b2d2
@ -1554,19 +1554,24 @@ void Client::OPGMTraining(const EQApplicationPacket *app)
|
||||
|
||||
Mob* pTrainer = entity_list.GetMob(gmtrain->npcid);
|
||||
|
||||
if(!pTrainer || !pTrainer->IsNPC() || pTrainer->GetClass() < Class::WarriorGM || pTrainer->GetClass() > Class::BerserkerGM)
|
||||
if (!pTrainer || !pTrainer->IsNPC() || pTrainer->GetClass() < Class::WarriorGM || pTrainer->GetClass() > Class::BerserkerGM) {
|
||||
return;
|
||||
}
|
||||
|
||||
//you can only use your own trainer, client enforces this, but why trust it
|
||||
if (!RuleB(Character, AllowCrossClassTrainers)) {
|
||||
int trains_class = pTrainer->GetClass() - (Class::WarriorGM - Class::Warrior);
|
||||
if (GetClass() != trains_class)
|
||||
if (GetClass() != trains_class) {
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//you have to be somewhat close to a trainer to be properly using them
|
||||
if(DistanceSquared(m_Position,pTrainer->GetPosition()) > USE_NPC_RANGE2)
|
||||
if (DistanceSquared(m_Position,pTrainer->GetPosition()) > USE_NPC_RANGE2) {
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
|
||||
// if this for-loop acts up again (crashes linux), try enabling the before and after #pragmas
|
||||
//#pragma GCC push_options
|
||||
@ -1659,7 +1664,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
// languages go here
|
||||
if (gmskill->skill_id > 25)
|
||||
{
|
||||
std::cout << "Wrong Training Skill (languages)" << std::endl;
|
||||
LogSkills("Wrong Training Skill (languages)");
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
@ -1674,7 +1679,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
// normal skills go here
|
||||
if (gmskill->skill_id > EQ::skills::HIGHEST_SKILL)
|
||||
{
|
||||
std::cout << "Wrong Training Skill (abilities)" << std::endl;
|
||||
LogSkills("Wrong Training Skill (abilities)");
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
@ -1693,11 +1698,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
|
||||
uint16 skilllevel = GetRawSkill(skill);
|
||||
|
||||
if(skilllevel == 0) {
|
||||
if (skilllevel == 0) {
|
||||
//this is a new skill..
|
||||
uint16 t_level = SkillTrainLevel(skill, GetClass());
|
||||
if (t_level == 0)
|
||||
{
|
||||
|
||||
if (t_level == 0) {
|
||||
LogSkills("Tried to train a new skill [{}] which is invalid for this race/class.", skill);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1717,6 +1723,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
case EQ::skills::SkillPottery:
|
||||
if(skilllevel >= RuleI(Skills, MaxTrainTradeskills)) {
|
||||
MessageString(Chat::Red, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
SetSkill(skill, skilllevel);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -1727,6 +1734,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
case EQ::skills::SkillSpecializeEvocation:
|
||||
if(skilllevel >= RuleI(Skills, MaxTrainSpecializations)) {
|
||||
MessageString(Chat::Red, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
SetSkill(skill, skilllevel);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
@ -1738,6 +1746,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
{
|
||||
// Don't allow training over max skill level
|
||||
MessageString(Chat::Red, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
SetSkill(skill, skilllevel);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1748,6 +1757,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
{
|
||||
// Restrict specialization training to follow the rules
|
||||
MessageString(Chat::Red, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
SetSkill(skill, skilllevel);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user