For processAutoSkillsRaise
How else can skills be updated without the 010E [Skill Level Changed] packet? Is there a way of requesting the 010F [Skills List] packet from the server?
From what I've noticed [Skills List] is only received when the character logs in to the map server. (unlike stat_info2, the soup of packets klabMouse mentioned, which is on map change and other events)
Any changes to the skills then would have to solely rely on [Skill Level Changed].
But as mentioned we are unable to receive [Skill Level Changed] while in the said teleport phase.
Edit: I am testing a cleaner fix thant that I originally mentioned for processAutoStatsRaise. It consists of setting $statChanged to 0 when we receive stat_info2 as well as checking if the stat was properly added. I added 2 global variables though which saves that stat to be added as well as its value. Will post results later after testing.
EDIT2: Fix for processAutoStatsRaise (After testing with 3 characters with ai_teleport_idle 0.5;)
Need someone else to double check via testing
Declare 2 new global Variables in globals.pm namely $statChanged2 and $statVal
Initialize those variables to 0 in functions.pl
In Receive.pm
Code: Select all
sub stat_info2 {
my ($self, $args) = @_;
return unless changeToInGameState();
my ($type, $val, $val2) = @{$args}{qw(type val val2)};
if ($type == 13) {
$char->{str} = $val;
$char->{str_bonus} = $val2;
debug "Strength: $val + $val2\n", "parseMsg";
} elsif ($type == 14) {
$char->{agi} = $val;
$char->{agi_bonus} = $val2;
debug "Agility: $val + $val2\n", "parseMsg";
} elsif ($type == 15) {
$char->{vit} = $val;
$char->{vit_bonus} = $val2;
debug "Vitality: $val + $val2\n", "parseMsg";
} elsif ($type == 16) {
$char->{int} = $val;
$char->{int_bonus} = $val2;
debug "Intelligence: $val + $val2\n", "parseMsg";
} elsif ($type == 17) {
$char->{dex} = $val;
$char->{dex_bonus} = $val2;
debug "Dexterity: $val + $val2\n", "parseMsg";
} elsif ($type == 18) {
$char->{luk} = $val;
$char->{luk_bonus} = $val2;
debug "Luck: $val + $val2\n", "parseMsg";
}
$statChanged = 0;
}
In CoreLogic.pm
Code: Select all
##### AUTO STATS RAISE #####
sub processAutoStatsRaise {
if (!$statChanged && ($char->{$statChanged2} == $statVal+1 || !$statVal) && $config{statsAddAuto}) {
# Split list of stats/values
my @list = split(/ *,+ */, $config{"statsAddAuto_list"});
my $statAmount;
my ($num, $st);
foreach my $item (@list) {
# Split each stat/value pair
($num, $st) = $item =~ /(\d+) (str|vit|dex|int|luk|agi)/i;
$st = lc $st;
# If stat needs to be raised to match desired amount
$statAmount = $char->{$st};
$statAmount += $char->{"${st}_bonus"} if (!$config{statsAddAuto_dontUseBonus});
if ($statAmount < $num && ($char->{$st} < 99 || $config{statsAdd_over_99})) {
# If char has enough stat points free to raise stat
if ($char->{points_free} &&
$char->{points_free} >= $char->{"points_$st"}) {
my $ID;
if ($st eq "str") {
$ID = 0x0D;
} elsif ($st eq "agi") {
$ID = 0x0E;
} elsif ($st eq "vit") {
$ID = 0x0F;
} elsif ($st eq "int") {
$ID = 0x10;
} elsif ($st eq "dex") {
$ID = 0x11;
} elsif ($st eq "luk") {
$ID = 0x12;
}
message TF("Auto-adding stat %s\n", $st);
$messageSender->sendAddStatusPoint($ID);
$statChanged = $st;
$statChanged2 = $st;
$statVal = $char->{$st};
last;
}
last;
}
}
}
}
Sorry I deleted the comments on processAutoStatsRaise to make it shorter
As for processAutoSkillsRaise I believe that yes, we have to have a task for it so as to pause the AI. Although, there will be the (hopefully) rare occurence of it teleporting because of an attack from a monster while it receives the skillChanged packet that will cause the bug. The only solution to this I believe is to relog.(Unless there is a way for us to request the skill list and or skill points remaining from the server)