|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Custom Custom Quests here |
|
|
|
11-15-2015, 07:07 PM
|
|
Discordant
|
|
Join Date: Jan 2007
Posts: 443
|
|
Artisan Titles
I hadn't seen this posted anywhere, so just wanted to toss out my solution to the Artisan titles. This likely isn't the best way to do it, but it works.
For reference, here's how the titles and tradeskills map out:
100 - Apprentice Artisan
200 - Journeyman Artisan
250 - Expert Artisan
300 - Master Artisan
Code:
sub EVENT_ENTERZONE {
# Apprentice Artisan
if ($client->GetRawSkill(60) > 99 && $client->GetRawSkill(61) > 99 && $client->GetRawSkill(63) > 99 && $client->GetRawSkill(68) > 99 && $client->GetRawSkill(65) > 99 && $client->GetRawSkill(69) > 99 && $client->GetRawSkill(64) > 99) {
quest::enabletitle(7);
}
# Journeyman Artisan
if ($client->GetRawSkill(60) > 199 && $client->GetRawSkill(61) > 199 && $client->GetRawSkill(63) > 199 && $client->GetRawSkill(68) > 199 && $client->GetRawSkill(65) > 199 && $client->GetRawSkill(69) > 199 && $client->GetRawSkill(64) > 199) {
quest::enabletitle(8);
}
# Expert Artisan
if ($client->GetRawSkill(60) > 249 && $client->GetRawSkill(61) > 249 && $client->GetRawSkill(63) > 249 && $client->GetRawSkill(68) > 249 && $client->GetRawSkill(65) > 249 && $client->GetRawSkill(69) > 249 && $client->GetRawSkill(64) > 249) {
quest::enabletitle(9);
}
# Master Artisan
if ($client->GetRawSkill(60) > 299 && $client->GetRawSkill(61) > 299 && $client->GetRawSkill(63) > 299 && $client->GetRawSkill(68) > 299 && $client->GetRawSkill(65) > 299 && $client->GetRawSkill(69) > 299 && $client->GetRawSkill(64) > 299) {
quest::enabletitle(10);
}
}
And the accompanying titles. IDs can be changed, of course.
Code:
INSERT INTO `eqemu`.`titles` (`id`, `skill_id`, `min_skill_value`, `max_skill_value`, `min_aa_points`, `max_aa_points`, `class`, `gender`, `char_id`, `status`, `item_id`, `prefix`, `suffix`, `title_set`) VALUES ('400', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '0', '-1', 'Master Artisan', '', '10');
INSERT INTO `eqemu`.`titles` (`id`, `skill_id`, `min_skill_value`, `max_skill_value`, `min_aa_points`, `max_aa_points`, `class`, `gender`, `char_id`, `status`, `item_id`, `prefix`, `suffix`, `title_set`) VALUES ('401', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '0', '-1', 'Expert Artisan', '', '9');
INSERT INTO `eqemu`.`titles` (`id`, `skill_id`, `min_skill_value`, `max_skill_value`, `min_aa_points`, `max_aa_points`, `class`, `gender`, `char_id`, `status`, `item_id`, `prefix`, `suffix`, `title_set`) VALUES ('402', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '0', '-1', 'Journeyman Artisan', '', '8');
INSERT INTO `eqemu`.`titles` (`id`, `skill_id`, `min_skill_value`, `max_skill_value`, `min_aa_points`, `max_aa_points`, `class`, `gender`, `char_id`, `status`, `item_id`, `prefix`, `suffix`, `title_set`) VALUES ('403', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '0', '-1', 'Apprentice Artisan', '', '7');
|
|
|
|
|
|
|
11-15-2015, 10:10 PM
|
|
Dragon
|
|
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
|
|
Keeping with a format you're familiar with, rather than going with lists/arrays, given/when, ranges, etc. (i.e. using your example).
You may want to consider using elsif's, rather than if's, since every if will be called otherwise. You may be noticing that the titles are changed (you may not, since it will be relatively fast/instantaneous).
Code:
sub EVENT_ENTERZONE {
# Master Artisan
if ($client->GetRawSkill(60) > 299 && $client->GetRawSkill(61) > 299 && $client->GetRawSkill(63) > 299 && $client->GetRawSkill(68) > 299 && $client->GetRawSkill(65) > 299 && $client->GetRawSkill(69) > 299 && $client->GetRawSkill(64) > 299) {
quest::enabletitle(10);
}
# Expert Artisan
elsif ($client->GetRawSkill(60) > 249 && $client->GetRawSkill(61) > 249 && $client->GetRawSkill(63) > 249 && $client->GetRawSkill(68) > 249 && $client->GetRawSkill(65) > 249 && $client->GetRawSkill(69) > 249 && $client->GetRawSkill(64) > 249) {
quest::enabletitle(9);
}
# Journeyman Artisan
elsif ($client->GetRawSkill(60) > 199 && $client->GetRawSkill(61) > 199 && $client->GetRawSkill(63) > 199 && $client->GetRawSkill(68) > 199 && $client->GetRawSkill(65) > 199 && $client->GetRawSkill(69) > 199 && $client->GetRawSkill(64) > 199) {
quest::enabletitle(8);
}
# Apprentice Artisan
elsif ($client->GetRawSkill(60) > 99 && $client->GetRawSkill(61) > 99 && $client->GetRawSkill(63) > 99 && $client->GetRawSkill(68) > 99 && $client->GetRawSkill(65) > 99 && $client->GetRawSkill(69) > 99 && $client->GetRawSkill(64) > 99) {
quest::enabletitle(7);
}
}
|
|
|
|
11-16-2015, 08:00 AM
|
Administrator
|
|
Join Date: May 2013
Location: United States
Posts: 1,594
|
|
Here's my re-write, you can use it if you'd like:
Code:
sub EVENT_ENTERZONE {
my %h = (7 => 99,
8 => 199,
9 => 249,
10 => 299);
foreach my $key (keys %h) {
if (CheckSkills($client, $h{$key})) {
quest::enabletitle($key);
}
}
}
sub CheckSkills {
my $client = shift;
my $skill_level = shift;
foreach my $skill (60, 61, 63..65, 68, 69) {
if ($client->GetRawSkill($skill) <= $skill_level) {
return 0;
}
}
return 1;
}
Here's an easier way to write the query:
Code:
INSERT INTO `titles` VALUES ('400', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '0', '-1', 'Master Artisan', '', '10'), ('401', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '0', '-1', 'Expert Artisan', '', '9'), ('402', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '0', '-1', 'Journeyman Artisan', '', '8'), ('403', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '0', '-1', 'Apprentice Artisan', '', '7');
|
11-16-2015, 12:24 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
So titles that require more than is inherently supported in the database (e.g., class & level) are set on a per-zone basis. Guess that makes sense. It's not part of the player profile, I suppose.
Maybe at some point there'll be a char_titles table with one-time granted title unlocks per character instead.
|
11-16-2015, 12:41 PM
|
|
Discordant
|
|
Join Date: Jan 2007
Posts: 443
|
|
I just run the check on zone. I know lots of servers put titles on an NPC that you hail to get it or whatever, or even on connect, but I wanted something as transparent as possible.
|
|
|
|
11-16-2015, 06:15 PM
|
|
Dragon
|
|
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
|
|
I figured KK was going to give you the condensed/efficient method, which is cool.
Though, drop this into Notepad++, in a very quick effort (have to run) to explain somewhat of what is happening. More technically correct terminology can be found throughout the internet. I used as many layman's terms as I could, however, I have to admit, I'm so used to those terms anymore, I may have done more harm than good trying the plain English approach. This is for anyone not just the OP, for those perhaps scratching their heads, wondering "what is that %h all about, seem em before but I still dont 'get it'":
Code:
sub EVENT_ENTERZONE {
## Build a Hash (%h) of key-value pairs
my %h = (7 => 99, ## key 7 has value of 99
8 => 199, ## key 8 has value of 199
9 => 249, ## key 9 has value of 249
10 => 299); ## key 10 has value of 299
## foreach goes through all the keys in the above hash placing that key into local variable $key
foreach my $key (keys %h) {
## first value of $key will be 7
if (CheckSkills($client, $h{$key})) {
## Comparison, calling subroutine CheckSkills exporting $client (the perl quest $client as used elsewhere in other quests)
## and the value of $h{$key} where $h is just a scalar (single key "pull") of %h, which key defined by { }, specifically
## $h{$key} whereas again $key is equal to 7 (on first foreach loop) so $h{7} <-- the key we're polling, which has a value of
## 99 as shown in the hash above, so jump down to subroutine CheckSkills now before reading line below (as it's the order of steps the Perl script takes)
## if this is anything but 0 (false) it will do the next line
## Enable title 7 (which as specified in the dbase is "Apprentice Artisan")
quest::enabletitle($key);
}
}
}
sub CheckSkills {
## local $client equals to first parameter passed by the "if (CheckSkills($client, $h{$key}))" line above, which we established was object $client
## shift in this case is a scalar (single) pull from the unblessed array made up of all parameters passed to a subroutine (in simple terms)
## that once used, it moves onto the next parameter within the array
my $client = shift;
## shift used again, so its now the next parameter that was passed which we established above was equal to 99
my $skill_level = shift;
## foreach here is going through 60, 61, 63 through 65, 68, 69 (it's entire contents being 60, 61, 63, 64, 65, 68, 69) placing
## the current value into local $skill
foreach my $skill (60, 61, 63..65, 68, 69) {
## Compare, if $client's raw skill in "$skill" (which on the first loop is 60) so
## if $client->GetRawSkill(60) is less than or equal to $skill_level which we established just above is 99
## then "return" (or back out of the subroutine with errorlevel 0 which is false)
if ($client->GetRawSkill($skill) <= $skill_level) {
## if comparison condition existed so we're backing out of this subroutine while passing an errorlevel of 0 (false)
return 0;
}
}
## we'll get to this line of code only when the "if ($client->GetRawSkill($skill) <= $skill_level)" did not exist,
## jumping out of the subroutine (CheckSkills) with an errorlevel of 1 (which in the world of 0 and 1, 1 is True)
return 1;
}
I'm sure someone with time can clean up the explanation a bit, btu gotta go. (always get interrupted this time of day from kids, wife, etc.) Hope it at least helps someone even just a tad.
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 04:15 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|