[Quest API] Add EVENT_SKILL_UP & EVENT_LANGUAGE_SKILL_UP to Perl/Lua (#2076)

Added EVENT_SKILL_UP to Perl/Lua

Adds sub EVENT_SKILL_UP output for use.
Exports:
$skill_id - ID of the skill being exported. Will export skill or language as the same so check below.
$skill_value - New skill level
$skill_max - Maximum value of skill
$is_tradeskill - 0 for non-tradeskill, 1 for tradeskill

Example usage:
sub EVENT_SKILL_UP {
if($is_tradeskill == 0) {
		quest::shout("Skill Increase! " . $client->GetCleanName() . " has increased their " . quest::getskillname($skill_id) . " to " . $skill_value . " of " . $skill_max . "!"); #deleteme
	}
	if ($is_tradeskill == 1) {
		quest::shout("Tradeskill Increase! " . $client->GetCleanName() . " has increased their " . quest::getskillname($skill_id) . " to " . $skill_value . " of " . $skill_max . "!"); #deleteme
	}
}

Adds sub EVENT_LANGUAGE_SKILL_UP output for use.
Exports:
$skill_id - ID of the skill being exported. Will export skill or language as the same so check below.
$skill_value - New skill level
$skill_max - Maximum value of skill

Example usage:
sub EVENT_LANGUAGE_SKILL_UP  {
		quest::shout("Language Increase! " . $client->GetCleanName() . " has increased their " . quest::getlanguagename($skill_id) . " to " . $skill_value . " of " . $skill_max . "!"); #deleteme
}

Co-authored-by: toxin06 <53322305+toxin06@users.noreply.github.com>
This commit is contained in:
nytmyr
2022-04-25 11:18:52 -05:00
committed by GitHub
parent 0d734a0837
commit b1311780a7
8 changed files with 85 additions and 5 deletions
+15 -1
View File
@@ -1500,7 +1500,6 @@ void Client::SetSkill(EQ::skills::SkillType skillid, uint16 value) {
m_pp.skills[skillid] = value; // We need to be able to #setskill 254 and 255 to reset skills
database.SaveCharacterSkill(this->CharacterID(), skillid, value);
auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct));
SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer;
skill->skillId=skillid;
@@ -2468,6 +2467,14 @@ bool Client::CheckIncreaseSkill(EQ::skills::SkillType skillid, Mob *against_who,
if(zone->random.Real(0, 99) < Chance)
{
SetSkill(skillid, GetRawSkill(skillid) + 1);
std::string export_string = fmt::format(
"{} {} {} {}",
skillid,
skillval+1,
maxskill,
0
);
parse->EventPlayer(EVENT_SKILL_UP, this, export_string, 0);
LogSkills("Skill [{}] at value [{}] successfully gain with [{}] chance (mod [{}])", skillid, skillval, Chance, chancemodi);
return true;
} else {
@@ -2495,6 +2502,13 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) {
if(zone->random.Real(0,100) < Chance) { // if they make the roll
IncreaseLanguageSkill(langid); // increase the language skill by 1
std::string export_string = fmt::format(
"{} {} {}",
langid,
LangSkill + 1,
100
);
parse->EventPlayer(EVENT_LANGUAGE_SKILL_UP, this, export_string, 0);
LogSkills("Language [{}] at value [{}] successfully gain with [{}] % chance", langid, LangSkill, Chance);
}
else