[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
+9 -1
View File
@@ -1148,6 +1148,7 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float
if(!CanIncreaseTradeskill(tradeskill))
return; //not allowed to go higher.
uint16 maxskill = MaxSkill(tradeskill);
float chance_stage2 = 0;
@@ -1176,7 +1177,14 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float
if (chance_stage2 > zone->random.Real(0, 99)) {
//Only if stage1 and stage2 succeeded you get a skillup.
SetSkill(tradeskill, current_raw_skill + 1);
std::string export_string = fmt::format(
"{} {} {} {}",
tradeskill,
current_raw_skill + 1,
maxskill,
1
);
parse->EventPlayer(EVENT_SKILL_UP, this, export_string, 0);
if(title_manager.IsNewTradeSkillTitleAvailable(tradeskill, current_raw_skill + 1))
NotifyNewTitlesAvailable();
}