Mercurial > hg > skillbot
comparison skillbot.pl @ 18:10587dbd634b
Ignoring bad data which was actually negative
author | Dominic Cleal <dominic@computerkb.co.uk> |
---|---|
date | Sat, 06 Dec 2008 17:27:17 +0000 |
parents | bef72aa85f2b |
children | 631123cc735c 7bcc70b2121a |
comparison
equal
deleted
inserted
replaced
17:bef72aa85f2b | 18:10587dbd634b |
---|---|
365 nick => $nick | 365 nick => $nick |
366 }; | 366 }; |
367 $loaded++; | 367 $loaded++; |
368 } | 368 } |
369 | 369 |
370 if (defined $c && $loaded == 0) | 370 if (defined $c && $loaded eq 0) |
371 { | 371 { |
372 irc_debug("EVE: Unable to find character %s for ID %lu", | 372 irc_debug("EVE: Unable to find character %s for ID %lu", |
373 $c, $uid); | 373 $c, $uid); |
374 next; | 374 next; |
375 } | 375 } |
413 return; | 413 return; |
414 } | 414 } |
415 | 415 |
416 # Check for changes in the skill, skip or cancel announcement | 416 # Check for changes in the skill, skip or cancel announcement |
417 if (defined $f->{skill}) { | 417 if (defined $f->{skill}) { |
418 next if $skill->id == $f->{skill}->id; | 418 return if $skill->id eq $f->{skill}->id; |
419 del_one_shot_timer($f->{timer}); | 419 del_one_shot_timer($f->{timer}); |
420 } | 420 } |
421 | 421 |
422 my $finish = $skill->finish_time - time(); | 422 my $finish = $skill->finish_time - time(); |
423 my $prefinish = $finish - 60; | 423 my $prefinish = $finish - 60; |
424 | 424 |
425 irc_debug("Character %s is training %s %lu (%s == %lu sec)", | 425 irc_debug("Character %s is training %s %d (%s == %d sec)", |
426 $f->{char}->name, $skill->name, $skill->level, | 426 $f->{char}->name, $skill->name, $skill->level, |
427 $skill->time_remaining, $finish); | 427 $skill->time_remaining, $finish); |
428 | 428 |
429 # Cap time at 3 months to ignore bad data | 429 # Ignore bad data |
430 if ($finish > 60 * 60 * 24 * 90) | 430 if ($finish < 0) |
431 { | 431 { |
432 irc_debug("Unreasonable finish time given of %s seconds, ignoring", | 432 irc_debug("Unreasonable finish time given of %s seconds, ignoring", |
433 $finish); | 433 $finish); |
434 return; | 434 return; |
435 } | 435 } |