Skill re-use delay bugs

This place is for Closed bug reports only. NOT for asking help!

Moderators: Moderators, Developers

Message
Author
Historm
Human
Human
Posts: 27
Joined: 01 Jun 2011, 01:59
Noob?: No

Skill re-use delay bugs

#1 Post by Historm »

The following code handles skill post delay. It is a small section of code found at the end of the file \src\Network\Receive\ServerType0.pm

Code: Select all

sub skill_post_delay {
	my ($self, $args) = @_;
	print unpack("H2",$args->{time})."\n";
	my $ID = $args->{ID};
	my $time = $args->{time};
	my $skillName = (new Skill(idn=>$ID))->getName();
	my $status = defined $statusName{'EFST_DELAY'} ? $statusName{'EFST_DELAY'} : ' Delay';
	
	$char->setStatus($skillName.$status,1,$time);
}
It recognizes the 3rd class skill delays, but it does not time them properly. For example if I use console command

Code: Select all

ss Highnessheal
the output is

Code: Select all

You are casting Highnessheal on yourself (Delay: 585ms)
You use Highnessheal on yourself (Lv: 7107)
98
You are now: Highnessheal Delay
You are now: EFST_POSTDELAY (Duration: 1s)
You are no longer: Highnessheal Delay
You are no longer: EFST_POSTDELAY
Kore is recognizing that Highnessheal has a skill delay seperate from the standard postdelay, but the duration of this new delay is wrong.

Is there a table of post delays that needs to be updated? Is the code itself buggy?

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Skill re-use delay bugs

#2 Post by EternalHarvest »

In my opinion, per-skill delays should be implemented differently (as a skill property, for example).

Historm
Human
Human
Posts: 27
Joined: 01 Jun 2011, 01:59
Noob?: No

Re: Skill re-use delay bugs

#3 Post by Historm »

I only understand a little C++ and java.

So, tell me, how do I do that?

Historm
Human
Human
Posts: 27
Joined: 01 Jun 2011, 01:59
Noob?: No

Re: Skill re-use delay bugs

#4 Post by Historm »

This is really bugging me (no pun intended) so I researched it as much as I could.

What seemed wrong was:

Code: Select all

   my $time = $args->{time};
Which made no sense. The time argument was a packed string of some sort, I could tell because the original writer used:

Code: Select all

print unpack("H2",$args->{time})."\n";
This actually seemed out of place to me since it would print a random string in the console. It did not seem like something that would be in the finished product. I figured out, after staring at it for a couple hours, that it was probably used to see what the unpacked string turned out to be when unpacked using different methods (by changing the "H2" parameter).

So I researched some perl and found that the "H2" parameter for unpack basically returns a 2 digit hex value. That seemed wrong, since I know the $time argument for setstatus() is supposed to be in milliseconds. At this point I basically figured, what the hell, why not just try different unpack parameters and see if any of them return reasonable decimal values. I picked "S" to start with and I was very pleased to find that the resulting values returned matched exactly with every skill re use delay I tested.

I switched it to "L" because shorts won't work for some of the longer re-use delays. (Mandragora howling, 30minutes or 1800000 ms).

When committed, the following code will correctly apply "<skillname> Delay" as a status effect (viewable by console command "s") for the correct duration. This can be used by the statusActive, statusInactive, and associated conditions in the blocks in the config.txt file.

sub skill_post_delay {
my ($self, $args) = @_;
my $ID = $args->{ID};
my $time = unpack("L",$args->{time});
my $skillName = (new Skill(idn=>$ID))->getName();
my $status = defined $statusName{'EFST_DELAY'} ? $statusName{'EFST_DELAY'} : ' Delay';

$char->setStatus($skillName.$status,1,$time);
}

Now, I don't know jack about perl or svn or trunk changes. So can someone help me with that?

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Skill re-use delay bugs

#5 Post by EternalHarvest »

Committed, with small modifications (data for unpack goes to packet_list if possible, "V" is preferred over "L" as the latter is non-portable without additional options):

http://openkore.svn.sourceforge.net/vie ... ision=7767

Post Reply