[Quest API] Add MaxSkills() to Perl/Lua. (#2621)

* [Quest API] Add MaxSkills() to Perl/Lua.

# Perl
- Add `$client->MaxSkills()`.

# Lua
- Add `client:MaxSkills()`.

# Notes
- Allows operators an easy short hand for maxing a player's skills for their level without needing to do all the looping and stuff on their own.

* Cleanup.

* Only set if it's higher than skill level player has.

* Add constant.
This commit is contained in:
Alex King
2022-12-06 08:46:21 -05:00
committed by GitHub
parent 91ea6462f2
commit f7fb1c9fe1
7 changed files with 45 additions and 14 deletions
+13 -13
View File
@@ -2,19 +2,19 @@
void command_max_all_skills(Client *c, const Seperator *sep)
{
if (c) {
Client *client_target = (c->GetTarget() ? (c->GetTarget()->IsClient() ? c->GetTarget()->CastToClient() : c)
: c);
auto Skills = EQ::skills::GetSkillTypeMap();
for (auto &skills_iter : Skills) {
auto skill_id = skills_iter.first;
auto current_skill_value = (
(EQ::skills::IsSpecializedSkill(skill_id)) ?
50 :
content_db.GetSkillCap(client_target->GetClass(), skill_id, client_target->GetLevel())
);
client_target->SetSkill(skill_id, current_skill_value);
}
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
t->MaxSkills();
c->Message(
Chat::White,
fmt::format(
"Maxed skills for {}.",
c->GetTargetDescription(t)
).c_str()
);
}