View Single Post
  #1  
Old 11-13-2008, 07:48 PM
cybernine186
Sarnak
 
Join Date: Feb 2008
Posts: 87
Default check_handin.pl broken/exploit

The plugin to handle things like plugin::check_handin is broken and has a HUGE exploit in it. Example I have had several issues were someone hand's in a bunch of gold or copper and they are given the reward regardless of the item number or count. Can anyone else confirm this, I know that this works because I have tried it my self and found it to be proven.

Here is the code that I currently use for the hand in.

check_handin.pl
Code:
# plugin::check_handin($item1 => #required_amount,...);
# autoreturns extra unused items on success
sub check_handin {
    my $hashref = shift;
    my %required = @_;
    foreach my $req (keys %required) {
	if ((!defined $hashref->{$req}) || ($hashref->{$req} != $required{$req})) {
            return(0);
	}
    }
    foreach my $req (keys %required) {
	delete $hashref->{$req};
    }
    return 1;
}

sub return_items {    
    my $hashref = shift;
    foreach my $k (keys(%{$hashref})) {
	next if($k == 0);
	my $r;
	for($r = 0; $r < $hashref->{$k}; $r++) {
		quest::summonitem($k);
	}
	delete $hashref->{$k};
    }
}

1;
Reply With Quote