Currently, when someone trains a skill at their class GM, it shows on the client that it is subtracting the amount of coin that it is supposed to, but when you zone, the coin reappears in your inventory. It looks like the problem is that we don't do any coin removal in the code for GM training here:
client_process.cpp
Code:
void Client::OPGMTrainSkill(const EQApplicationPacket *app)
{
if(!m_pp.points)
return;
GMSkillChange_Struct* gmskill = (GMSkillChange_Struct*) app->pBuffer;
Mob* pTrainer = entity_list.GetMob(gmskill->npcid);
if(!pTrainer || !pTrainer->IsNPC() || pTrainer->GetClass() < WARRIORGM || pTrainer->GetClass() > BERSERKERGM)
return;
//you can only use your own trainer, client enforces this, but why trust it
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
if(GetClass() != trains_class)
return;
//you have to be somewhat close to a trainer to be properly using them
if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2)
return;
if (gmskill->skillbank == 0x01)
{
// languages go here
if (gmskill->skill_id > 25)
{
cout << "Wrong Training Skill (languages)" << endl;
DumpPacket(app);
return;
}
cout << "Training language: " << gmskill->skill_id << endl;
IncreaseLanguageSkill(gmskill->skill_id);
}
else if (gmskill->skillbank == 0x00)
{
// normal skills go here
if (gmskill->skill_id > HIGHEST_SKILL)
{
cout << "Wrong Training Skill (abilities)" << endl;
DumpPacket(app);
return;
}
SkillType skill = (SkillType) gmskill->skill_id;
if(!CanHaveSkill(skill)) {
mlog(CLIENT__ERROR, "Tried to train skill %d, which is not allowed.", skill);
return;
}
int16 skilllevel = GetRawSkill(skill);
if(skilllevel == 0) {
//this is a new skill..
int16 t_level = SkillTrainLevel(skill, GetClass());
if (t_level == 0)
{
return;
}
SetSkill(skill, t_level);
} else {
switch(skill) {
case BREWING:
case MAKE_POISON:
case TINKERING:
case RESEARCH:
case ALCHEMY:
case BAKING:
case TAILORING:
case BLACKSMITHING:
case FLETCHING:
case JEWELRY_MAKING:
case POTTERY:
if(skilllevel >= RuleI(Skills, MaxTrainTradeskills)) {
Message_StringID(13, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
return;
}
default:
break;
}
// Client train a valid skill
SetSkill(skill, skilllevel + 1);
}
}
m_pp.points--;
}
I will try to figure out the formula for skill prices and if I can, I will try to use the same code that is used when purchasing items from merchants to allow GM Training to actually have a cost.
If anyone has suggestions or other info on this, feel free to post it
