|
|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
| Support::Windows Servers Support forum for Windows EQEMu users. |
 |
|
 |

02-28-2018, 11:02 PM
|
 |
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
You probably want to add some logic for specialization (skills 43-47) as shown below, due to the fact that a caster is only ever supposed to go above 50 in one school of spells.
Code:
sub EVENT_LEVEL_UP {
AutoTrain() if $client->GetGM();
}
sub AutoTrain {
$client->Message( 15,
"Your experiences across the realm have infused you with increased"
. " power and knowledge..." );
$CanSkill = sub { $client->CanHaveSkill(shift) };
$MaxSkill = sub { $client->MaxSkill( shift, $class, $ulevel ) };
$RawSkill = sub { $client->GetRawSkill(shift) };
$SetSkill = sub { $client->SetSkill( shift, shift ) };
# set all available skills to maximum for class at current level
foreach my $skillNum ( 0 .. 42, 48 .. 74 ) {
next unless $CanSkill->($skillNum);
my $maxVal = $MaxSkill->($skillNum);
next unless $maxVal > $RawSkill->($skillNum);
$SetSkill->( $skillNum, $maxVal );
}
# if client is a caster and can specialize
if ( $CanSkill->(43) ) {
# get current raw value for all spell-casting spec skills
my %spec = map { $_ => $RawSkill->($_) } ( 43 .. 47 );
# if one spell-casting spec skill is above 50,
# set it to the max value for the client's current level
# (this skill is deleted from hash and doesn't get calculated again)
if ( my $main = first { $spec{$_} > 50 } keys %spec ) {
$SetSkill->( $main, $MaxSkill->($main) );
delete $spec{$main};
}
# set spell-casting spec skills to max value for client's current level
# all skill levels but the first one that goes over 50 are capped at 50
foreach my $skillNum ( keys %spec ) {
next if $spec{$skillNum} == 50;
my $maxVal = $MaxSkill->($skillNum);
$SetSkill->( $skillNum, $maxVal > 50 ? 50 : $maxVal );
}
}
# scribe all spells for current level
quest::scribespells( $ulevel, $ulevel );
# train all discs for current level
quest::traindiscs( $ulevel, $ulevel );
}
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
|
 |
|
 |
 |
|
 |

09-29-2018, 01:54 AM
|
|
Fire Beetle
|
|
Join Date: Jul 2011
Posts: 4
|
|
Quote:
Originally Posted by c0ncrete
You probably want to add some logic for specialization (skills 43-47) as shown below, due to the fact that a caster is only ever supposed to go above 50 in one school of spells.
|
Thanks for this! For those that come here from Google, as I did, here's my translation of this into lua. I've never written so much as a "hello world" in perl, so I did my best to understand what you wrote. I've also never written a "hello world" in lua for that matter; but I skipped straight to this, ha. If anybody wants to optimize this, have at it.
GitHub for syntax highlighting
Code:
function event_level_up(e)
-- All skills except caster specializations
local skills = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
70, 71, 72, 73, 74, 75, 76 };
-- Determine max possible skill and assign it at each level up
for k,v in ipairs(skills) do
local max_skill = e.self:MaxSkill(v);
local raw_skill = e.self:GetRawSkill(v);
local can_have = e.self:CanHaveSkill(v);
if ( max_skill > 0 and raw_skill < max_skill and can_have ) then
e.self:SetSkill(v, max_skill);
end
end
-- Determine if client is a caster and can specialize
if ( e.self:CanHaveSkill(43) ) then
-- Specialization skills
local special = { 43, 44, 45, 46, 47 };
-- Create tables of raw skills and max skills
local raw_skills = {};
local max_skills = {};
for k,v in ipairs(special) do
raw_skills[k] = e.self:GetRawSkill(v);
max_skills[k] = e.self:MaxSkill(v);
end
-- Check each specialization and determine what to do
for k,v in ipairs(special) do
if ( raw_skills[k] == 50 ) then
-- do nothing
elseif ( raw_skills[k] > 50 and raw_skills[k] < max_skills[k] ) then
e.self:SetSkill(v, max_skills[k]);
elseif ( raw_skills[k] < 50 and raw_skills[k] < max_skills[k] ) then
if ( max_skills[k] <= 50 ) then
e.self:SetSkill(v, max_skills[k]);
else
e.self:SetSkill(v, 50);
end
end
end
end
-- Scribe all spells up to current level
eq.scribe_spells(e.self:GetLevel());
-- Train all disciplines up to current level
eq.train_discs(e.self:GetLevel());
end
|
 |
|
 |
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
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 12:16 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |